how to loop over the structure fields and get the type of data ?!
770 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ano
le 22 Mai 2017
Réponse apportée : James Tursa
le 23 Mai 2017
hello! I would like to loop over the fields of a structure and get the type of data for each field, so I can do further manipulation if a field is a matrix , how can I implement this into matlab ?? thank you very much !
0 commentaires
Réponse acceptée
James Tursa
le 23 Mai 2017
You could loop over the fieldnames, e.g.
fn = fieldnames(mystruct);
for k=1:numel(fn)
if( isnumeric(mystruct.(fn{k})) )
% do stuff
end
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Structures dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!