Reputation: 1
I want a greater detail over the matrix higher dimensions, i.e. I have an array with 6 dimensions like P(i,j,k,l,m,n)
. Just like in C all arrays are stored continuously over memory. I want to know how dimensions greater than 4 like 5 or 6 can be initialized and operated.
Upvotes: 0
Views: 285
Reputation: 363
In MATLAB, you don’t need to initalize arrays like in C, but if you say
P(4,7,6,3,2) = 0;
you create a 5-dimensional array (4-by-7-by-6-by-3-by-2) of zeros. If you want the array to contain an arbitrary value (here 3.14), use, e.g.,
P = repmat(3.14, [4, 7, 6, 3, 2]);
As for how these arrays operate, they operate the same way as arrays of other dimensions, with the exception that not all operations make sense on arrays of many dimensions.
Upvotes: 1