Organizing 2D matrices of unequal column length into single 3D array
Afficher commentaires plus anciens
Hey !
I am trying to arrange my 2D matrix data of unequal coulumn length as a 3D array. I can do it for equal length matrices but requires help for unequal matrices. I used the following code for equal lengths but can anyone help in modifying this code for arranging 2D matrices of unequal length into 3D array. The empty elements may taken as NaN.
% Let Num of 2D arrays
my3Darray=zeros(20,6,x);
for ind=1:x
V=randi(10,20,3);
I=randi(10,20,3);
my2Darray = [I,V];
my3Darray(:,:,ind) = my2Darray;
end
5 commentaires
DGM
le 28 Oct 2022
How are the 2D arrays presented in practice? Are they separate variables? Are they stored in a cell array?
I have to ask, because the example given is just generating random 10x40x3 arrays and trying to page-concatenate them. The given example does not have unequal column length issues at all, since the random arrays are identical in size. However, it does have an addressing issue, since you're generating 10x40x3 arrays and you're trying to insert each 3-page array into a single page of the output array.
Clarification is needed.
Rab Nawaz
le 28 Oct 2022
Rab Nawaz
le 31 Oct 2022
Rab Nawaz
le 31 Oct 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!