Referencing variables in the workspace
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Image Analyst
2014-11-6
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.
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!