size (): Gets 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, returning the number of columns of the matrix to the second output variable C.
(3) size (a,n) If you add another n to the input parameter of the size function and assign a value of N to 1 or 2, size returns the number of rows or columns of the matrix. where R=size (a,1) The statement returns the number of rows of the matrix A, c=size (a,2) The time that the statement returns a column count of matrix A.
Numel (): Returns the total number of elements contained in an array or vector。 Ex:n = Numel (A)
Length (): If A is a non-empty array, the value that returns the greater number of rows and columns, that is the equivalent of Max (size (a)); If a is an empty array, 0 is returned; If A is a constant quantity, the length of a is returned, N=max (size (A)); If A is a non-empty array, the maximum dimension of A is returned, and if a is an empty array, the longest non-0-dimensional number in a is returned.
nargin: As a keyword, the number of input variables for the monitoring function.
FIX: Move 0 closer to rounding.
Additional knowledge: 1)There may be a lot of people who don't know about vector a, and what The Matrix A,a (a) will do, here's an experiment: a = [1, 4; 2, 3]a = 5:8 The output is as follows:>> a (a) ans = 5 8 6 7 As you can see, the matrix A in parentheses is the element in which each element selects the corresponding position in vector A, thus forming a new matrix b=a (a);
Additional knowledge: 2)The vector name (ones (n,1),:) is actually the line extension of the vector, extending into the matrix as a vector, the number of rows n is the same as each row of elements, the following example: B =1 2 3 4 >> B (ones (5,1),:) ans = 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
Use of size, Numel, length, and fix functions in MATLAB