Referencing variables in the workspace
2 views (last 30 days)
Show older comments
Hello all,
I am using a script which accesses an mdf file and then stores the channels chosen into arrays/mat in matlab. While it does this, it adds extensions to the end of the channel name ex: Engine_speed_24. I can see this variable in the workspace. I want to know is there a way of accessing or referencing these variables which are generated by an external script/function in my main code? I need to plot these variables but I don't want to type in the name of the variable each time, as the extension might change if the channel changes.
Ex - Channel names - Engine_speed, Engine_torque. Run func -> extracts these channels from mdf file -> stores variables as Engine_speed_XX and Engine_torque_YY, time_XX and time_YY
I need a way to plot them against time as I don't know what the extensions might be.
Thanks
2 Comments
Image Analyst
on 6 Nov 2014
What is the extension? If it's .mdf, that's not going to change depending on what's inside, since you can't know what's inside until you actually open the .mdf file. So is the extension the "_24"? Or something else? Since you have access to the m file, it's best if you have it return a variable with the same name each time rather than do whatever it does to make variable names that are dependent on something in the file.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!