How to cut dimensions of 3d arrays in a cell.
1 次查看(过去 30 天)
显示 更早的评论
I have one 34*1 cell.
every array in it have 3 dimensions, all same (720*360*365)
I want to know how to cut all arrays like this: (700:720 * 300:360 * :)
0 个评论
采纳的回答
Yuan Li
2019-10-28
B = cell(34,1);
for ii = 1:34
B{ii} = precips{ii}(700:720,300:360,:);
end
Then you will get a new cell, each element of the new cell is of size 21*61*365.
更多回答(1 个)
Alex Mcaulley
2019-10-28
Being A your cell array:
newA = arrayfun(@(i) A{i}(700:720,300:360,:),1:numel(A),'uni',0)
2 个评论
Alex Mcaulley
2019-10-28
Then, you can transpose the cell array:
newA = arrayfun(@(i) A{i}(700:720,300:360,:),1:numel(A),'uni',0)'
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!