HP Forums
Matrix to Vector - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Matrix to Vector (/thread-19807.html)



Matrix to Vector - Amer7 - 04-14-2023 10:11 AM

Hi,
I'm facing some issues again around matrices.

When I multiply two matrices and the product of a matrix is [1,1] Matrix, I want to turn this Matrix to a Vector [1].

lets say
M22 is my matrix [1,1]
when i type
M23:=vector(M22);

It doesn't work, why I need this vector is to be able to be able to multiply matrix by a vector. - And later view the Values in Matrix editor Using EDITMAT()

Like In Matrix menu - There is an option to Edit, Delete, Vect, Send
When You press Vect it vectorises the matrix turning it [1] I need this, but what is the programing command?

Because when I use M22[1,1] in this form
Ss0:=M22[1,1];
M75:=M20*Ss0;
EDITMAT(M75,"Matrix product of M20 and Ss0");

I get Input Error


RE: Matrix to Vector - Joe Horn - 04-14-2023 12:20 PM

Use the REDIM command. E.g. REDIM( [[ 11,22,33 ]] , 3) yields [ 1,2,3 ]. See the built-in Help screen for more info about REDIM.


RE: Matrix to Vector - Amer7 - 04-15-2023 10:04 AM

(04-14-2023 12:20 PM)Joe Horn Wrote:  Use the REDIM command. E.g. REDIM( [[ 11,22,33 ]] , 3) yields [ 1,2,3 ]. See the built-in Help screen for more info about REDIM.

Thank you very much it works perfectly

Basically

If I want exp. Matrix M57 to be a vector ie. 1x1

REDIM(57,1);

Example:
Local M11,M57;

M11:=M1xM2;
M57:=REDIM(M11,1);
EDITMAT(M57, "vector matrix value is this");

Just a precaution
If you were to Multiply this REDIM(57) "vector" and you get like invalid size, input error etc. Do it like M1*M57(1);

Works like aCharm,
Thank you!