How do i call a pushbutton of my GUI from a MATLAB function which is integrated into a SIMULINK model ?

2 Ansichten (letzte 30 Tage)
Hi everybody !
I'm trying to control a driving Simulator from a GUI and some buttons placed on a steering wheel. The buttons have the function to turn the status of driving assistant Systems on or off. When i press a button on the GUI the callback function verifies the actual status of the driving assistant Systems based on a counter (global variable), loads a new Image(ON or OFF) into the button and raises the counter. My plan for the steering wheel button is the following: I get a signal (zero or one) in my SIMULINK model. This signal is the input of a MATLAB function which should call the GUI buttonfunction. So how do i call a pushbutton of my GUI from this function?

Antworten (1)

Adam
Adam am 6 Mai 2016
Bearbeitet: Adam am 6 Mai 2016
Note: This works fine in regular Matlab, I don't know anything about Simulink and whether there are reasons why you can't do this there.
Just factor out the function under your GUI into a different location that does not require the callback parameters, then you can call it from anywhere e.g.
function pbCallback( hObject, eventdata, handles )
calculateStuff( handles.someArg, handles.someOtherArgs )
Then calculateStuff is a function that takes relevant arguments and can be called from anywhere. You should never look to be calling a callback function explicitly from elsewhere in your code.

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by