Using evalin to read .m script

4 ビュー (過去 30 日間)
James
James 2013 年 5 月 17 日
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 Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by