Perform command on whole structure (reduce size)
6 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 13 May 2015
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
More Answers (0)
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!