Subscribe Bookmark RSS Feed

How to convert vector into matrix?

GoSook

New Contributor

Joined:

May 12, 2017

For example, I have a variable that has 500,000 values.

I want to convert them into matrices of 100 rows and 50 columns.

How can I do?

2 REPLIES
David_Burnham

Super User

Joined:

Jul 13, 2011

You can use the Shape function:

 

m = [1 2 3 4 5 6];
mat = Shape(m,2,3);
show(m,mat);
show(nrows(m),ncols(m));
show(nrows(mat),ncols(mat));
-Dave
GoSook

New Contributor

Joined:

May 12, 2017

Thanks!!!