Introduction to the usage of the size () function in Matlab

Source: Internet
Author: User
The size () function in Matlab is used to obtain the number of rows and columns in the matrix. This article introduces the usage and basic examples of the size () function in Matlab, for more information about the coders, see this article. The size () function in Matlab is used to obtain the number of rows and columns in the matrix.

(1) s = size (),

If there is only one output parameter, a row vector is returned. When the first element of the row vector is the number of rows in the matrix, the second element is the number of columns in the matrix.

(2) [r, c] = size (),

When there are two output parameters, the size function returns the number of rows in the Matrix to the first output variable r, and returns the number of columns in the Matrix to the second output variable c.

(3) size (A, n) if n is added to the input parameter of the size function and 1 or 2 is assigned to n, size returns the number of rows or columns in the matrix. Where r = size (A, 1) the number of rows returned by the statement, and c = size (A, 2) the number of columns returned by the statement.

In addition, length () = max (size ()).

Summary of size () in Matlab:

For matrix

Number of rows in size (A, 1) matrix
Number of columns in size (A, 2) matrix
[M, n] = size (A), m indicates the number of rows in matrix A, and n indicates the number of columns in matrix.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.