How to display structs only in a struct with fields?
显示 更早的评论
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);
采纳的回答
更多回答(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)
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!