How do I rename a structure?
Mostra commenti meno recenti
Hello all,
I'm using a software that exports recorded data as a Matlab structure, then analyzing the results with a Matlab script. The fields in each structure are named identically. (It is a 1x14 structure with 50 fields).
I want to write a loop to process each structure sequentially, reading the names from an array or .txt file. When I try the following, it creates a 1x1 structure named "filename" with my data structure inside it, then I have to still use the name of that file when accessing the data inside it.
filename = load('MeasureData_20160123_094305_3')
I would like to have "filename" be identical to the structure I loaded, not a 1x1 structure with the data inside it. That way I can do something like this:
plot(filename(11).x, filename(11).y);
Instead of this:
plot(filename.MeasureData_20160123_094305_3(11).x, filename.MeasureData_20160123_094305_3(11).y);
I have also tried this, which produces the 1x14 structure I want, but it still requires me to manually enter the file name:
load('MeasureData_20160123_094305_3')
a = MeasureData_20160123_094305_3
How can I automate this process so I don't have to manually change the filename in my script? Thanks for the help, Aaron
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Data Import and Analysis in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!