Perform command on whole structure (reduce size)
2 ビュー (過去 30 日間)
古いコメントを表示
Hello I have a data structure (named 'Data'). It is a mix of two and three tiers. It consists of a load of data arrays in roughly the same dimensions (9111 x 9021 or 9111 x 9020). I want to crop all of the arrays in one go i.e. I want a new structure which is the same but has (400:7000,4000:8000) of each array.
Is there a way to do this, instead of doing B1_2 = Data.sat.B1(400:7000,4000:8000); for every array?
Apologies if answered before, I couldn't find any results, perhaps b/c I'm not sure on the terminology. Thank you
0 件のコメント
採用された回答
Walter Roberson
2015 年 5 月 13 日
If it is a struct, use structfun with 'uniform', 0 . You will probably find it easier to write a small recursive routine:
function r = trimstruct(s)
if isstruct(s)
r = structfun(@trimstruct, s, 'Uniform', 0);
else
r = s(400:7000,4000:8000);
end
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!