필터 지우기
필터 지우기

problem in xlsread function

조회 수: 2 (최근 30일)
rafi abdul
rafi abdul 2013년 3월 27일
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

답변 (1개)

Walter Roberson
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.
  댓글 수: 1
rafi abdul
rafi abdul 2013년 3월 27일
Thanks for reply.i have copied these two lines in my load callback function and when i am calling load callback function it is showing error message like index exceeds max dimension.and in handles.data it is showing 0*0 matrix.how to proceed. thanks rafi

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

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by