MATLAB: Display results in one matrix (nested for loops

arrayMATLABmatrix

Hello,
I am working on my final year project, a script that detects moods/emotions generated by audio files. I am currently stuck here:
for i=1:2
for j=4:10
for k=2:3
for l=1:2
for m=1:2
X=(i,j,k,l,m);
End, end, etc.
The reason for this is that each element i,j,k,l,m of the array has several values (i.e. i is 1 or 2, j is 4 through 10 etc.)
Now the problem: I get each possible array in a single line, is there any way to store all of them in a single matrix?
Thank you in advance!
M.

Best Answer

Mihnea, you probably want
X(i,j,k,l,m) = ...
For large matrices you might want to pre-allocate memory:
X = zeros(2,10,3,2,2);