- what format are they (e.g. .mat files, text files, etc.) ?
- If they are .mat files, do they all contain variables with exactly the same names?
- If they are .mat files, how many variables per file?
- can you upload some sample files?
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
How can I change the field name from a cell of structs1x91?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I have a cell of structs constituted by 91 columns, each one contains a matrix and I've loaded this matrices with "load".
Since the matrices are 91, I inserted them into a cell, but Matlab randomly gives to each one a random value (first vector, then vactor 3, then vector, then vector 1 and so on), and so I don't know how to access by a cycle to all the structs.
For this reason I'm asking if it is possible to change the field names given by Matlab in one shot. I can't use the usual notation beacuse in this way I should do 91 iterations, and I have to do these 91 iterations other 7 times.. and so I would spend too much time.
Thank you
1 Kommentar
Stephen23
am 28 Jun. 2019
Bearbeitet: Stephen23
am 28 Jun. 2019
"...but Matlab randomly gives to each one a random value"
That is very unlikely, MATLAB does not do things randomly (in fact it is extremely difficult to make computers do things randomly). So you should investigate this order (possibly it comes from the filenames or fieldnames, but as you did not give us any information on these, this is just a guess).
...I don't know how to access by a cycle to all the structs."
I doubt that manipulating fieldnames is a good approach: that is what indexing is for.
If you are loading the data in a loop then you can trivially assign the loaded data to an array using indexing (e.g. a cell array or a structure array).
It would help if you clarified some questions about your files:
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!