The following examples will better explain each and every thing what is stated above.
1 dimensional array:
These are the column vectors and row vectors.They can be visualized as a series of values laid out in a row or column, with a single subscript used to access individual array elements from computer memory
for example: we have an array i.e
in computer memory it will be stored as
This is how MatLab stores one dimensional array. |
2 dimensional array/matrix:
for example we have a 3×3 matrix i.e
In computer memory it will be stored as stated "column major order" i.e explained below.
This is how MatLab stores two dimensional array. |
Again the first column is used to represent memory locations(address) that MATLAB assigns to each element, 2nd column is used to explain column major order principle that MATLAB follows to store array elements in computer memory where each different color is representing different columns, and third column is used to represent position of elements in array that we use to access our elements from memory locations.
3 dimensional array/matrix:
suppose we have a 2×2×2 matrix, now you can see bellow that MATLAB stores it in the same way.
This is how MatLab stores three dimensional array. |
Now again you can see that the first column is used to represent memory locations(address) that MATLAB assigns to each element, 2nd column is used to explain column major order principle that MATLAB follows to store array elements in computer memory where each different color is representing different columns, and third column is used to represent position of elements in array that we use to access our elements from memory locations.
? All higher level multidimensional arrays are stored in the same way.
0 comments:
Post a Comment