Problem using num2cell!

5 vues (au cours des 30 derniers jours)
BN
BN le 6 Nov 2022
Commenté : BN le 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.

Réponse acceptée

Walter Roberson
Walter Roberson le 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.
  1 commentaire
BN
BN le 6 Nov 2022
Thank you so much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Large Files and Big Data dans Help Center et File Exchange

Tags

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by