Problem using num2cell!

4 次查看(过去 30 天)
BN
BN 2022-11-6
评论: BN 2022-11-6
Hi, I wanted to split the contents of “A” into separate cells of “C”, where the third dimension of “A” including in each cell. Although num2cell work with no error, the results are wrong!
C = num2cell(A,3);
So far so good, but in the arrays of C, every 1x1x444 cell array contains repetitious values, which is wrong!
C{1,1}
val(:,:,1) =
18.6770
val(:,:,2) =
18.6770
val(:,:,3) =
18.6770
val(:,:,4) =
18.6770
.
.
.
val(:,:,444) =
18.6770
This is the same for other arrays for example C{1,2}, C{2,3}, etc.
I checked the script using another dataset (namely itsok.mat, and it worked properly).
I attached both of my datasets. The A.mat is the file I have a problem with, while the itsok.mat file is the dataset that is ok with the script.
Thank you all.

采纳的回答

Walter Roberson
Walter Roberson 2022-11-6
A(:,:,2) - A(:,:,1)
is all zero. So is A(:,:,15) - A(:,:,9) and all other possibilities.
nnz(diff(A,[],3))
is zero. Your third dimension of your array is bit-for-bit copies of your first plane.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by