Performing Action to ALL 'struct' Variables
Afficher commentaires plus anciens
Is there a way to perform the same action on several variables of type 'struct'?
In my case, I have 30 separate 'struct' variables (with non-logical names), and each of them contains a single vector of 200 elements. I only want to deal with the second half of these elements so I need something like:
struct_name = struct_name.data(100:end)
But need to keep the name of the struct variable intact. Does anyone have any suggestions?
I hope this made sense!
Réponse acceptée
Plus de réponses (1)
Fangjun Jiang
le 19 Mai 2011
Would this help?
a(200).b=1;
a(200).c=0;
NewStruct=a(100:end);
Or, Do you mean keep the struct variable name, not the field names:
a(1:99)=[];
Now I think you mean this:
a.Data=1:200;
a.Data(1:100)=[]
1 commentaire
Philip
le 19 Mai 2011
Catégories
En savoir plus sur Variables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!