How to show one column matrix with muilt-column

If the matrix has only one column, then it will take a lot of space to display it in Matlab, for example

Of course, sometimes the function reshape

can help a lot. But when the number of elements is prime, reshape

no longer works. If I am in Mathemtica I can solve this problem like

Is there an elegant method for this question in Matlab?

+3


source to share


1 answer


Using sprintf , you can print the array in different ways:

disp(sprintf([repmat('%d\t',1,4) '\n'], (1:17).'))

      



Result:

1       2       3       4
5       6       7       8
9       10      11      12
13      14      15      16
17  

      

+2


source







All Articles