Creating structs with variable names of read-in data parameter names
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Mark
am 11 Feb. 2014
Kommentiert: Walter Roberson
am 11 Feb. 2014
I'm reading large excel file with both headers and data values. I've attached a sample.
I have many 'Days' (Day 1, Day 2, Day 3 etc.) of data. On any given 'Day,' I may have a few 'tests' (test1, test2, test3 etc.). Within those tests I have a couple variances, like stage, or if the column contains input data or measured values.
I have several columns of data correpsoinding Day 1, Day 2 and so on. What I want is to create a struct for each 'Day' and test whose variable names are the names of the day and test number, so I could say
M = Day1.test1
or something like that. The end goal is to write a csv file for each individual test. I was thinking structs would be a good way to do that, but if someone has a better suggestion I would gladly take it. Thanks
2 Kommentare
Akzeptierte Antwort
Walter Roberson
am 11 Feb. 2014
Dynamic field names can get you everything except for the outer structure name, but you could toss everything into one container struct.
M = alldays.(DayField).(TestField)
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!