Problem with BottonDownFcn for a Pushbutton

2 次查看(过去 30 天)
Hi
I created a simple GUI like showing below.
What I would like to achieve is that when I click on the 'Start' button, it will 1) display 'hello' in the command window, and 2) the button will become invisible.
So firstly I wrote the code below to create an uicontrol which is a push button. Noticed that I set the 'ButtonDownFcn' of the push button to call another function 'clickObject'.
Then in the 'clickObject' function section I wrote the code below hoping that when I click on the button, 1) it will display 'hello' in the Command Window, and 2) the button will become invisible.
However, when I click on the button, nothing happens. The button is still there which I don't understand.
Can anyone help me please?

采纳的回答

Salad Box
Salad Box 2018-3-23
Just found the answer myself.
'ButtonDownFcn' is not suitable for 'pushbutton', rather I should use 'CallBack' instead.
So I have to change the line from 'ButtonDownFcn',@clickObject', to 'CallBack',@clickObject'.
Problem solved...

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by