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.
回答 (2 件)
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