MATLAB: Run m files by using GUI

MATLABmatlab gui

I need to run m file from the push button by using GUI and enter some variables before the run.How can I apply these by GUI? There is a loop in the m file. Is that a problem for the GUI application? I will be appreciated with your answers. If there is a simple example, I will be so satisfied.
With best regards.

Best Answer

m files can be scripts or functions, scripts (group of MATLAB statements) you just run them by writing their name, functions you also execute by writing their name but you can also provide arguments and provide outputs.
Please refer to your MATLAB documentation
doc scripts %execute this to learn about scripts
Also this:
doc functions %execute this to learn about functions
No problems with loops if you know what your are doing, I can't help you more with just the details you provided.