Using evalin to read .m script

1 次查看(过去 30 天)
I have a .m script already written that reads text files as input. I'm writing a GUI in GUIDE and I want to use a push button to get the values from my .m script. I am assuming that the evalin function is the correct route to go here. But I am unsure exactly how to use it. I am relatively new to MATLAB. How do I store the values from the .m script in 'base' and then call those values from my GUI? Thanks in advance!

采纳的回答

Image Analyst
Image Analyst 2013-5-17
编辑:Image Analyst 2013-5-17
evalin() is not the correct route, or at least not the preferred route. Just put a button on your GUI, view the callback, and paste the code from your m-file into the button's callback. That's what I'd do if the m-file is small enough.
If it's a really long complicated m-file, then I'd just make it a function that returns one of more variables that you can accept when you call it from your button's callback. Like in the callback
[out1, out2, out3] = my_m_file(in1, in2);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by