how does matlab read matrix
Show older comments
Hi, simple quick question: how does Matlab read matrix? From left to right or from top to bottom?
4 Comments
Jan
on 18 Nov 2012
What exactly does "read" mean?
Tomas
on 18 Nov 2012
Walter Roberson
on 18 Nov 2012
Functions do not take variables from matrices, with the exception of varargin.
Jan
on 18 Nov 2012
The question is still not clear. Perhaps it helps, if you explain what you are trying to achieve.
Answers (2)
The values are store in column order in the memory:
A = [1 2 3; 4 5 6; 7 8 9];
A(:)
>> [1; 4; 7; 2; 5; 8; 3; 6; 9]
This means: The 1st element is 1 stored in the data of the matrix A is 1, the 2nd is 4.
Azzi Abdelmalek
on 18 Nov 2012
Edited: Azzi Abdelmalek
on 18 Nov 2012
A=[1 2 3;4 5 6;7 8 9]
the result is
1 2 3
4 5 6
7 8 9
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!