フィルターのクリア

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 Center および File ExchangeCell Arrays についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by