Pass data from figure to main GUIDE pushbutton callback function

조회 수: 1 (최근 30일)
Kim Lopez
Kim Lopez 2017년 11월 20일
댓글: Kim Lopez 2017년 11월 20일
I created a pushbutton in main gui using guide and also programmatically created a figure with pushbutton which inputs data. How can I pass the data when the pushbutton is press from the figure and send it to the main gui pushbutton callback function? I have attached an image for clarification.

채택된 답변

KL
KL 2017년 11월 20일
편집: KL 2017년 11월 20일
You need to update the hObject handle using,
guidata(hObject,handles);
Upon edit, save the new table data in this handle,
hObject.TableData = get(uitableHandle,'Data');
and then in the pushbutton callback use it like,
plot(hObject.TableData)
  댓글 수: 3
KL
KL 2017년 11월 20일
After you update the derated table (be it anywhere), do
hObject.deratedData = derated.Data;
guidata(hObject,handles);
Now your changes are updated to the structure. Now when you are inside your main paushbutton callback, retrieve it like,
dataToPlot = hObject.deratedData;
Kim Lopez
Kim Lopez 2017년 11월 20일
Wow, that works well. Thank you so much.

댓글을 달려면 로그인하십시오.

추가 답변 (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