linking gui with coding

1 回表示 (過去 30 日間)
Steven Chong
Steven Chong 2015 年 5 月 26 日
コメント済み: Walter Roberson 2015 年 6 月 9 日
How can i link or interface my gui pushbutton with my coding on the command window. Example, when i click a pushbutton called the add function on the gui window, then the output will be sum of two values?

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 5 月 26 日
The output where?
If the output is just the display, then in the callback of the pushbutton call disp() or fprintf()
If the output is to be to the base workspace or to a variable that you could specifically request the value of, then see http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F
If the output needs to go into the "ans" stream of the command window and it is important that you not have to type anything at the command window, then the task gets more difficult. I think it could be done, but it would require using parts of MATLAB that are not well documented. Setting up a keyboard shortcut would be easier for this situation than clicking a button.
  4 件のコメント
Steven Chong
Steven Chong 2015 年 6 月 9 日
name of my function will be the name of my m-file i saved as?
Walter Roberson
Walter Roberson 2015 年 6 月 9 日
"well the coding is written in m-file format where by typeing the file name in the command window"
so use that file name where I used the example add()

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

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by