How to acces a variable in structure when i only have the string saved into a variable
Afficher commentaires plus anciens
Hello,
Here is my code :
[filename, pathname] = uigetfile('*.mat', 'Select the MATLAB mat file');
a = load(filename);
I'm asking a file to the user. And then loading the array of the coresponding file into a. But it is saved as a Structure. a is a Structure that contained a variable named by the name of the filename. Which is itself containing the array. Am I right ? After that I want to plot it.
plot(a.??);
The problem is, that i can't right a.filename. Cause filename is not the real name, but the name of the varaible that contain the string I want.
I hope you'll understand my problem.
Thank you in advance.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Filename Construction dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!