Problem using num2cell!
조회 수: 4 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
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 Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!