Organizing 2D matrices of unequal column length into single 3D array
古いコメントを表示
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 件のコメント
DGM
2022 年 10 月 28 日
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
2022 年 10 月 28 日
Rab Nawaz
2022 年 10 月 31 日
Rab Nawaz
2022 年 10 月 31 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!