How to control GUI with external m-file

7 views (last 30 days)
Leo Zhai
Leo Zhai on 12 Dec 2019
Commented: Leo Zhai on 19 Dec 2019
I created a GUI, named 'StartEngine', there is a button 'Run'(handles.pushbutton1) on the GUI.
Now, I opened the GUI and I want to make Background color of this button to be gray with a m-file.
It means how could I implement the following command out of StartEngine.m (corresponding to StartEnge.fig)
set(handles.pushbutton1, 'BackgroundColor', [0.5, 0.5, 0.5]);
  11 Comments
Walter Roberson
Walter Roberson on 18 Dec 2019
figs = findall(0, 'type', 'figure');
get(figs, 'Name')
get(figs, 'Tag')

Sign in to comment.

Accepted Answer

Leo Zhai
Leo Zhai on 18 Dec 2019
I figure out an alternative solution, which do NOT use "control GUI with external m-file" but use "GUI control itself with feedback of external m-file"
test4.jpg
Before, I thought the GUI(StartEngine.m) and the external m-file(ExcuteRun.m) run parallel, GUI will not "wait for" the external m-file runing to end and get its result/output.
Now, I found the code is "single-thred", GUI will continue after external m-file run to end.
test5.jpg
By the way, I did not find error until now. I wonder if some risk exists using this way.
  4 Comments
Leo Zhai
Leo Zhai on 19 Dec 2019
Thanks for your greate advice, I will think through it.

Sign in to comment.

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!