Renaming Imported Variable with Initally Unknown Name
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello All,
I am currently working on an automated data post-processing script which imports raw data (.dat file) and does some dynamic analysis. The issue I am currently having is that the variables that are imported are automatically appended with a certain number (ex. we have a vector for velocity... it becomes velocity_3 or velocity_4, etc...). The letters in the variable stay the same and are known, but the appended number depends on how the test to collect the data was conducted, so this is unknown beforehand.
I would like to rename all of the variables (ex. speed = velocity_3) so that I can analyze the variables (ex. speed) later on in my code. Right now I have some code which determines the name of each variable (ex. speed_3) and stores it to a "char" variable, however I cannot figure out how to call out the variable since it is stored as a char value.
Any recommendations on how to proceed from here, or an easier solution would be greatly appreciated!
Thanks!
0 commentaires
Réponse acceptée
Iain
le 21 Août 2014
eval or setfield can do something for you I think
You would do better to change your code that reads the files to not name the variables in such a silly way though.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!