MATLAB Answers

how to make a push button to be pressed 3 times after other push button is pressed ?

17 ビュー (過去 30 日間)
Dany Majed
Dany Majed 2019 年 3 月 25 日
コメント済み: Dany Majed 2019 年 3 月 25 日
Hello,
so i created two pushbuttons in gui in matlab so let us call the first pushbutton pushbutton1 and lets call the second push button pushbutton2 this is already done but just written this for clarification so my question is how could i make when pushbutton2 is pressed in the gui it causes pushbutton1 to be pressed 3 times after each other since in pushbutton1 i am having a specific functions and plots and matrices so i need the user once he presses the pushbutton2 so it could cause the pushbutton1 that contains functions plots and matrices to be pressed 3 times. Thanks in advance.

採用された回答

Kevin Phung
Kevin Phung 2019 年 3 月 25 日
You can jsut call out the callback for pushbutton2 three times in your callback for pushbutton1.
button1 = uicontrol('style','pushbutton','callback',@push1callback)
button2 = uicontrol('style','pushbutton','callback',@push2callback)
function push1callback(hObj,event)
%this button gets pushed
disp('first button is pushed')
for i = 1:3
push2callback % runs the second button 3 times.
end
end
function push2callback(hObj,event)
disp('Second button is pushed')
end
  5 件のコメント
Dany Majed
Dany Majed 2019 年 3 月 25 日
Thanks it worked i really do appreciate that

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by