looping though data structures of different sizes
Afficher commentaires plus anciens
Hi Folks, please advise if you can....
Im extracting data from a structure in a for loop as follows:
for i = 1:1600
Struct = xml2struct(filename);
time(i) = Struct.time.v1);
data(i) = Struct.data.v2);
end
The problem is most of the Structures have 1 value for v1 and v2 but around 100 of the structures have multiple values. Hope can I deal with this in a loop and extract all the v1 and v2 values into one vector?
Thanks in advance for any advice!
2 commentaires
Guillaume
le 31 Jan 2018
Well, what do you want to do when there's multiple values. Just store the first one? an average or other statistics? store all of them?
Note that calling a variable Struct is a bad idea. Personally, I'd call it filexml.
Chris O'Donnell
le 31 Jan 2018
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements 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!