Error when calling a PushButton programetically in Appdesigner

I am trying to design a Pushbutton in Appdesigner, which when pushed it programetically pushes other buttons, which are present in the same gui. I have tried the following code:
% Button pushed function: SetZeroALLButton
function SetZeroALLButtonPushed(app, event)
ButtonPushed(app, matlab.ui.eventdata.SetZeroButton_5Data)
end
to push this button:
% Button pushed function: SetZeroButton_5
function SetZeroButton_5Pushed(app, event)
app.zero_weg_R = app.FederwegEditField_2.Value;
end
But it doesn't work. Any ideas why it is not working?

답변 (1개)

Cris LaPierre
Cris LaPierre 2021년 11월 10일
Pushing a button just triggers the execution of a specific callback function. However, you can also call callback functions manually inside another callback function. Based on what you have shared, my callback function for the first pushbutton might look like this.
% Button pushed function: SetZeroALLButton
function SetZeroALLButtonPushed(app, event)
% run callback for SetZeroButton_5 button
app.SetZeroButton_5Pushed(event)
end
See this answer for another example.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2021년 11월 8일

댓글:

2021년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by