MATLAB Answers

Automatic activation of a button

26 ビュー (過去 30 日間)
SUDIP PODDAR
SUDIP PODDAR 2011 年 10 月 26 日
Hi Thanks for your reply. I am using guide. I have two gui figure window. In the first window i have two edit box & a pushbutton. In second window I have an edit box & a pushbutton. From first window i want to take two input through edit box. In the second window I want to disply the summation of these two in the edit box of second window, after pressing the pushbutton of the first window. The summation funtion is written in the pushbutton of the second window. I want to activate the pushbutton of second window automatically by pressing the pushbutton of first window. How i do that. Plz plz help me. Thanks again.

  0 件のコメント

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

採用された回答

Amardeep
Amardeep 2011 年 10 月 26 日
Pass the two variables in a handles structure when calling the second window. When the push button in the second window is then clicked call the variables from the handles structure and add them up.

  6 件のコメント

表示 3 件の古いコメント
Sean de Wolski
Sean de Wolski 2011 年 10 月 26 日
You probably set its 'enable' option to 'on' or 'off'.
SUDIP PODDAR
SUDIP PODDAR 2011 年 10 月 26 日
enable option is in property inspector. but there is no enable command. I want to activate the pushbutton of second window by clicking the pushbutton of the first window automatically. Activating code must be written in first window pushbutton. plz plz help me.
Sean de Wolski
Sean de Wolski 2011 年 10 月 26 日
set(GUIHandles.Pushbutton2,'enable','on');
now you just have to name the buttons and handles structures accordingly

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 10 月 26 日
The earlier responses will not accomplish what you are trying to do.
In order to activate (that is, execute) the callback of the second pushbutton when you press the first, you need to get the handle of the second pushbutton, and you need to get() the Callback of that pushbutton, and then you have to invoke that callback.
The exact mechanisms for invoking the callback once you have found it, varies according to how the callback was coded. If the callback was coded as a string (as tends to be the case when you use GUIDE) then you should use eval() to execute the string.

  11 件のコメント

表示 8 件の古いコメント
SUDIP PODDAR
SUDIP PODDAR 2011 年 11 月 14 日
Sorry for delay
SUDIP PODDAR
SUDIP PODDAR 2011 年 11 月 14 日
your answer is correct but mistakenly i accept another one. Sorry for that.
Walter Roberson
Walter Roberson 2011 年 11 月 14 日
If you get() the callback and execute it in the manner I showed, then *all* appropriate parts of the callback will be executed. It would be tricky (but not impossible) for the callback to detect that it was being executed indirectly instead of directly because that button itself had been pushed.

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by