problem in xlsread function
1 回表示 (過去 30 日間)
古いコメントを表示
Hi i have loaded one excel file of 2 columns and 10 rows into uitable and ploted graph using plot callback.i have saved xls file and when i am trying to check data in excel file using xlsread it is showing 0*0 matrix.how to proceed please help
function plot_Callback(hObject, eventdata, handles)
% hObject handle to plot (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
data=get(handles.uitable1,'data');
x=data(:,1);
y=data(:,2);
plot(x,y)
% --- Executes on button press in save.
function save_Callback(hObject, eventdata, handles)
% hObject handle to save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
data=get(handles.uitable1,'data');
FileName = uiputfile('*.xls','Save as');
xlswrite(FileName,data,'MEISTER');
% --- Executes on button press in load.
function load_Callback(hObject, eventdata, handles)
% hObject handle to load (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
filename=uigetfile('*.xls')
[handles.data handles.text]= xlsread(filename)
a=handles.data
0 件のコメント
回答 (1 件)
Walter Roberson
2013 年 3 月 27 日
You need to
set(handles.uitable1, 'data', mat2cell(handles.data))
Also, when you plot,you should use
data = cell2mat(get(handles.uitable1, 'data'));
That is, uitable() take cell array for their data.
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!