Column first and Row first

Source: Internet
Author: User

The first to use MATLAB mixed with C + + programming people, for column priority and line first some unfamiliar.

Looked at the wiki, found that: Row priority and column precedence refers to row-first storage and column-First storage.


Explanation of Wiki:

with a definition as theMthe 3x3 matrix for example:column-First Storagerefers to Matlab first save the first column of 3 elements, and then save the second column, and finally save the third column of the element, so that the 9 matrix elements in MATLAB is sorted from 1 to 9, so when the matrix element is called, M (2) refers to the second element of the first column, M (6) Refers to the second column of the third element (of course, these two elements can also be called in two-dimensional way, M (2) corresponds to M (a), M (6) corresponds to M (2,3));row-First Storageinstead, save 3 elements of the first row, and then save the elements of the second and third rows.


For example, we call the FSCANF function of Matlab to read the data in the text file into the matrix.

The data is read in the order of the text, one after the other.

Line first: The stored matrix pattern is consistent with the pattern of the text arrangement

Column precedence: The stored matrix pattern is stored in column format, one column is full, and the second column is stored.

Column first and Row first

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.