How to display structs only in a struct with fields?
Show older comments
I'm trying to display only the 1x1 struct portions and hide the character portions in a struct with fields.
aTable=struct2table(S);
disp(aTable);
Accepted Answer
More Answers (1)
t='11'; s.q=1;
S=struct('a',t,'b',s,'c',s,'d',[s,s])
p=reshape( namedargs2cell(S) , 2,[]);
keep=structfun(@(f)isstruct(f) & isscalar(f), S);
s=struct(p{:,keep});
disp(s)
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!