Is there a one line command in GAUSS to convert a matrix to array or an array to a matrix?
(For example,vec2mat command in matlab converts an array into a matrix and A=A(:) converts a matrix into an column vector)
Thanks.
1 Answer
0
accepted
There are a few functions for this sort of transformation. Here are a few examples. Let us know if you have any questions about them.
//Create a 2x3 matrix A = { 1 2 3, 4 5 6 }; //Convert to a 2x3 array A_2darray = mattoarray(A); //Convert 2x3 array to 2x3 matrix Amat = arraytomat(A_2darray); //Convert to a 2x1x3 array A_3darray = areshape(A, 2 | 1 | 3); //Create column vector //from 'A' by row A_vec = vecr(A);
Your Answer
1 Answer
0
accepted
There are a few functions for this sort of transformation. Here are a few examples. Let us know if you have any questions about them.
//Create a 2x3 matrix A = { 1 2 3, 4 5 6 }; //Convert to a 2x3 array A_2darray = mattoarray(A); //Convert 2x3 array to 2x3 matrix Amat = arraytomat(A_2darray); //Convert to a 2x1x3 array A_3darray = areshape(A, 2 | 1 | 3); //Create column vector //from 'A' by row A_vec = vecr(A);