GUI how to display table data into figure
古いコメントを表示
My problem is: I try to read some data from excel file, first display as table data inside Matlab GUI, then I want to display data in the figure (GUI). I know I can re-read the excel data again to display in the figure. But how I can get table handle and transfer to figure as data input? I am a beginner in GUI, please help me. I highly appreciate it.
function uitable1_CreateFcn(hObject, eventdata, handles)
[num,txt,raw]=xlsread('C:\Program Files\data_example.xls');
set(hObject,'data',num,'ColumnName',txt);
handles.uitable1=hObject;
% guidata(hObject,handles);
function axes1_CreateFcn(hObject, eventdata, handles)
tab_data=get(handles.uitable1,'Data') %%%%%always tell me wrong "Attempt to reference field of non-structure array." %%%%
handles.axes1=plot3(tab_data(:,1),tab_data(:,2),tab_data(:,3));
guidata(hObject,handles.axes1);
採用された回答
その他の回答 (1 件)
Khanh
2014 年 12 月 30 日
You have to set data for the table before retrieve it.
[num,txt,raw]=xlsread('C:\Program Files\data_example.xls');
% Set data table (num variable is data you want to set)
set(handles.uitable1,'Data',num)
% And then get data table
tab_data=get(handles.uitable1,'Data')
Hope this can help you.
カテゴリ
ヘルプ センター および File Exchange で Data Type Identification についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!