필터 지우기
필터 지우기

Delete part of the third dimension for arrays that store in the cell

조회 수: 2 (최근 30일)
BN
BN 2020년 3월 24일
댓글: Stephen23 2020년 3월 25일
Hello all,
If I had just one 3d array I know I can use:
new = 3darray(:,:,2:end)
In order to delete the first number of the third dimension.
But as I have a lot of arrays that stored in the cell, I don't know how to do it automatically. Here what I tried so far:
for i= 1:numel(tmax) %if tmax is my cell that 3d arrays stored in it
b = tmax(i,1);
b = b(:,:,2:end);
end
But it doesn't work correctly and result me b = 1x1x0 cell
I'm sorry but as my data (even when I tried to cut just part of it) are too large to attach I just insert a picture here:
Thank you all

채택된 답변

Sindar
Sindar 2020년 3월 24일
편집: Sindar 2020년 3월 24일
to access the data in cells (rather than the cells themselves) and to store data in a new cell array, use {}
for i= 1:numel(tmax)
% iterates through every cell of tmax, regardless of dimensions
temp = tmax{i};
b{i} = temp(:,:,2:end);
end
% shapes b (originally 1D) to match tmax
b = reshape(b,size(tmax));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by