Home >Web Front-end >JS Tutorial >Briefly describe the usage of size() function in Matlab_javascript skills
The size() function is used to obtain the number of rows and columns of the matrix.
(1)s=size(A),
When there is only one output parameter, a row vector is returned. The first element of the row vector is the number of rows of the matrix, and the second element is the number of columns of the matrix.
(2)[r,c]=size(A),
When there are two output parameters, the size function returns the number of rows of the matrix to the first output variable r, and returns the number of columns of the matrix to the second output variable c.
(3) size(A,n) If you add another item n to the input parameter of the size function and assign a value to n with 1 or 2, size will return the number of rows or columns of the matrix. Among them, r=size(A,1) returns the number of rows of matrix A, and c=size(A,2) returns the number of columns of matrix A.
In addition, length()=max(size()).
Summary:
For matrix A
size(A,1) Number of rows of matrix A
size(A,2) Number of columns of matrix A
[m,n]=size(A), m is the number of rows of matrix A, n is the number of columns of matrix A
Regarding the usage of the size() function in Matlab, the editor will introduce you to this much. I hope it will be helpful to you!