How to give the total amount of row from a matrix as a value?
1 view (last 30 days)
I need to define the total amount of row of a matrix as a variable
and don't how to extract this number.
For example, let
In this case the row number would be 5.
I thought there would be a command such as
but did not work.
Hopefully someone knows how to solve this
Thank you for your help
Matt Fig on 30 Mar 2011
size(M,1) % The number or rows of an array.
size(M,2) % The number of columns of an array.
S = size(M);
S(1) % The same as size(M,1)
S(2) % The same as size(M,2)
A = rand(4,5,2,2);
S = size(A)
notice the connection between S and the argument to RAND.