How to control GUI with external m-file
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Leo Zhai
am 12 Dez. 2019
Kommentiert: Leo Zhai
am 19 Dez. 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 Kommentare
Walter Roberson
am 18 Dez. 2019
figs = findall(0, 'type', 'figure');
get(figs, 'Name')
get(figs, 'Tag')
Akzeptierte Antwort
Leo Zhai
am 18 Dez. 2019
4 Kommentare
Adam Danz
am 19 Dez. 2019
Sounds like a decent plan, except part 2 ;)
One difficulty you may experience is troubleshooting any of those components when something goes wrong. Let's say you have a variable named "V" in one of the xx.m files in the bottom row. V should always be a positive integer but you noticed it's value is NaN. You have no idea where that value is coming from. It could come from any of these possibilities:
- from StartEngine
- from xx.m #1
- from xx.m #2
- From within ExecuteRun.m
- from an interaction in ExecuteRun between StartEngine and xx.m #1
- from an interaction in ExecuteRun between StartEngine and xx.m #2
- from an interaction in ExecuteRun between xx.m #1 and xx.m #2 within
and lots of other possibilities. This organization often make reproducibility difficult or even impossible.
One way to deal with many input and output variable is to organize them into a structure. For example,
function [motion, position] = movingObject(action)
end
Where the ouputs & inputs contains many fields
motion.velocity
motion.acceleration
motion.previousPosition
motion.currentPosition
% etc...
Anyway, I'm sure you'll figure this stuff out soon.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!