Delete some columns from structure array
Show older comments
Hi. I am working with a structure array S (1 X 50,000) with 10 fields in which some columns are multiuple entries ands sub-set of another column.
Here is the input,
S(1).f1=[10,20,30 40,50,60], S(1).f2=[100,20,50,60,70,140],.........S(1).f10=[11,22,33,44,55,66];
S(2).f1=[56,98,74,87,99] and S(2).f2=[101,54,69,20,11],....... S(2).f10=.........[54,55,65,74,90];
S(3).f1=...... and S(3).f2=.....
S(4).f1=.... and S(4).f2=.....
.
.
S(13).f1=[10,20,30 40,50,60,70,80,90,100], S(13).f2=[100,20,50,60,70,140,160,200,220,300],.........S(13).f10=[11,22,33,44,55,66,65,72,34,61];
.
.
.
As we can see S(1) is a sub-set of S(13). I want to write a loop to compare all the columns and retain only the ones with maximum length; meaning that to delete S(1) and retain S(13) in the above example.
Can someone please help me with this.
Accepted Answer
More Answers (0)
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!