How to get Pushed Button activity

4 次查看(过去 30 天)
Hello People,
i have two buttons: One is called: PressButtontostartForloop
And the other one is called: ActivityButton
if i Press the Button : PressButtontostartForloop the compiler goes right into the function below...
I want to manipulate the function below, by pushing the ActivityButton from the GUI.
I'm new in Matlab App designer and dont know how to handle this problem.
function PressButtontostartForloopValueChanged(app, event)
for Counter=1 : 10000000
if ActivityButton.Value ==1 %<-- This Line
%Do Something
end
end
end
I read something about callback functions. But i dont know how to do it..
Best regards,
MS

回答(1 个)

Sahithi Kanumarlapudi
Hi,
From your question it looks like you would like to manipulate the callback function of one button based on the other button's activity. You would not need two buttons inorder to perform that. You could have one button in the app and use the callback of this button to manipulate the data.
Below code might serve as an example
ActivityButton = uibutton(fig,'push',...
'ButtonPushedFcn', @(btn,event) ActivityButtonPushed(btn,ax));
Perform all your calculations in the function defnition of ActivityButtonPushed
For more information refer to the following link

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by