Problem using num2cell!

4 Ansichten (letzte 30 Tage)
BN
BN am 6 Nov. 2022
Kommentiert: BN am 6 Nov. 2022
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.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Nov. 2022
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.

Weitere Antworten (0)

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by