Organizing 2D matrices of unequal column length into single 3D array
Mostra commenti meno recenti
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 Commenti
DGM
il 28 Ott 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
il 28 Ott 2022
Rab Nawaz
il 31 Ott 2022
Rab Nawaz
il 31 Ott 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrices and Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!