Push button in GUI

1 回表示 (過去 30 日間)
Rohit Bhoi
Rohit Bhoi 2015 年 11 月 10 日
コメント済み: Adam 2015 年 11 月 10 日
I have two push button in my DAQ GUI where one push button reads the data from analog channel and plot graph where second one is for save as. How can I get that first push button 'data' in second so that I can save it.

回答 (1 件)

Adam
Adam 2015 年 11 月 10 日
編集済み: Adam 2015 年 11 月 10 日
In the first button callback:
handles.data = readData(...);
guidata( hObject, handles );
In the second callback:
data = handles.data;
...
Obviously you don't need to assign to a local variable in the second callback, you can just use handles.data directly. readData(...) is just a placeholder for whatever means you use to read your data.
  2 件のコメント
Rohit Bhoi
Rohit Bhoi 2015 年 11 月 10 日
it is giving me error that ,"Undefined function or method 'readData' for input argument of type 'double'"
Adam
Adam 2015 年 11 月 10 日
Well, like I said, that is just a place holder for whatever code you already have that reads in your data. You can put whatever code you want there so long as you assign the data you want to access elsewhere onto the handles structure.

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

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by