how to execute an .m file by clicking push button in an another gui file?

조회 수: 3 (최근 30일)
hi, i have created a gui file with a push button. i want to run another matlab file by clicking the push button in gui file. help me regarding this.
thank you.

답변 (2개)

Image Analyst
Image Analyst 2015년 5월 12일
Just put the name of the second m-file in the callback function of your push button. If the file is a function, rather than a script, you can also pass it input arguments if you want to or need to.
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 5월 12일
At works you might need to use the 'run' command.
Image Analyst
Image Analyst 2015년 5월 13일
Not sure what that means, but I've tried running a script in another script, in a simple function, and in the pushbutton callback of a program written with GUIDE, and in all cases simply putting this on it's own line
secondscript
ran secondscript.m. I did not have to do
run('secondscript.m');

댓글을 달려면 로그인하십시오.


Othmane ELMOUATAMID
Othmane ELMOUATAMID 2018년 7월 18일
This answer works well with me.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by