Renaming Imported Variable with Initally Unknown Name
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Iain
2014-8-21
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!