Structure fields in Matlab
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello!
I have a structure that can contain several substructures, and sub-sub-structures and so on. I will never know for sure how deep is my structure.
But I'll know for sure that each substructure of my structure will contain the field "SignalName" and this is exactly what I need.
Is there a command for getting what I need? I tried to create an algorithm but looks impossible because I never know how much to dig into the structure...
Until now I have not found any command to help me..
Thanks! Bye
1 Kommentar
Walter Roberson
am 28 Jul. 2012
You do not appear to have explained what it is you need ? You have nested structures of unknown depth and you need to do something with the fields named SignalName, but you did not indicate what you want to do with those fields.
Antworten (2)
Sean de Wolski
am 27 Jul. 2012
Bearbeitet: Sean de Wolski
am 27 Jul. 2012
It sounds like you will want to use fieldnames to get a cell array of the fields. You could then use ismember with 'SignalName' and field names to find out if it is a member. If it is, dynamically call it using dynamic field names. If it is not, recursively continue.
My question to you:
Why do you receive structures whose structure you don't know a priori? I would invest more time in trying to organize these.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!