MATLAB: Execute .m file using GUI

sss

I would like to run a .m file by using pushbutton in GUI, the .m file output is an array which is not loaded in the workspace. Is there anyway to execute .m file using GUI or to load the output.
Thanks, Arif

Best Answer

Is your .m file a function or a script? You need to understand the difference. Functions and Scripts.
If it is a function, you can use output argument to pass in the data. If it is a script, you can run the .m file directly with the GUI function callback to set up the data, although this approach is not recommended.