convert data from two 3D arrays into three 2D arrays
1 回表示 (過去 30 日間)
古いコメントを表示
I have two 3D arrays A and B with dimensions n1 x n2 x n3. Indices i = 1:n1, j = 1:n2, k:1:n3 represent values of some variables var1, var2, var3 (for example var1(i) = var1Min + (i-1)*delta_var1).
I would like to convert two given 3d arrays A and B into three 2d arrays var1Array, var2Array, var3Array, with values of the variables var1, var2, var3 and indices representing values in arrays A and B (for example var1Array(i,j), i represents data from A, j represents data from B, i represents Adata = minA + (i-1)*delta_A, j represents data from B, Bdata = minB + (j-1)*delta_B)
Are there any functions to do it automatically in MATLAB? If not, please, give me some hints how to do it.
0 件のコメント
回答 (2 件)
Sulaymon Eshkabilov
2021 年 6 月 13 日
編集済み: Sulaymon Eshkabilov
2021 年 6 月 13 日
It is quite simple:
var1Array = A(:,:,1); var2Array = A(:,:,2); var3Array=A(:,:,3);
% OR combining A and B into one array
var1Array = [A(:,:,1);B(:,:,1)] var2Array = [A(:,:,2); B(:,:,2)];var3Array=[A(:,:,3);B(:,:,3)]
...
madhan ravi
2021 年 6 月 13 日
A = rand(2,2,2)
B = rand(2,2,2)
Data = [A; B] % naming variables is a bad idea , keep them concatenated as one 3D matrix, is much simpler than naming each page
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!