How to get Pushed Button activity

4 views (last 30 days)
Mustafa Sereflioglu
Mustafa Sereflioglu on 15 Jul 2020
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

Answers (1)

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi on 21 Jul 2020
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

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!