Deleting last element of a nested structure
1 次查看(过去 30 天)
显示 更早的评论
MySignalData here has multiple 1x1 structs like DIA,DIB,...DIZ,timestamp. Each DIA etc. has multiple 1x1 structs like pt1151,pt9999 etc which has a Data variable. I want to remove the last element in Data such that the size is 21707x1 and I want to apply this to all such ptxxxx in DIA,...DIZ.
How do I vectorize this process or I need to do in a for-loop? Even with a loop, it seems a daunting exercise. Any input is welcome.
1 个评论
回答(1 个)
Sudhakar Shinde
2020-11-11
Example:
s.a = 1;
s.b = 2;
s.c = 3;
Remove field b.
field = 'b';
s = rmfield(s,field)
s = struct with fields:
a: 1
c: 3
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!