Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Can I use whether or not a function runs as a conditional statement?

1 回表示 (過去 30 日間)
Kristen O'Mara
Kristen O'Mara 2018 年 3 月 8 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I need some commands to execute if a pushbutton is pressed while certain other conditions are true. How can I write in a conditional statement "if y and z are true(conditions) and some function has run, then execute these commands" in coding form? This is in a GUI by the way if that helps.

回答 (1 件)

elham kreem
elham kreem 2018 年 3 月 8 日
編集済み: elham kreem 2018 年 3 月 8 日
this is a short example ; if the first condition is true :
x= 2 ; y = 3;
if (x+y)>4
disp x , disp y
else x-y
end
********************** now if the first condition is wrong :
if (x+y)> 5
disp x , disp y
else x-y
end
  1 件のコメント
Kristen O'Mara
Kristen O'Mara 2018 年 3 月 8 日
So I get that but here's the code in question
if handles.pushbutton2.BackgroundColor == [1 0 0] && handles.pushbutton2.String == 'push me' && pushbutton1_Callback(hObject, eventdata, handles)
handles.pushbutton2.BackgroundColor = [1 1 1];
handles.pushbutton2.String = ' ';
So basically when the function runs it means pushbutton1 was pushed and I need that to cause a command to execute.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by