看板 MATLAB 關於我們 聯絡資訊
大家好 我設計了兩個GUI介面 第一個GUI的Tag為"gui_his" 今天我從gui_his的一個按鈕抓資料 資料為"cursor.data" 我希望第二個GUI的按鈕可以抓到此資料 因為我想要將這筆資料傳遞到第二個GUI做運算 我的程式碼為 %在gui_his裡 function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %資料來源我就簡略了 setappdata(handles.gui_his,'mydata',cursor.data) %然後在第二個gui裡 function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) mydata = getappdata(handles.gui_his,'mydata'); 但程式出現錯誤為 Reference to non-existent field 'gui_his'. 可以請教是哪裡出錯了嗎?? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.4.211 ※ 文章網址: http://www.ptt.cc/bbs/MATLAB/M.1405064070.A.084.html
aada:試試看加個global cursor.data 07/11 19:23
aada:在setappdata(...)下 07/11 19:23
yiheng0410:可以把資料存在root下 data = setappdata(0,'data'); 07/11 22:42
yiheng0410:再用 getappdata 抓出來 07/11 22:42