i am using a for loop to access each element in a column of an xls file and display the data with the help of GUI.my code is:

1 回表示 (過去 30 日間)
this code is written in the pushbutton callback:
for i=1:4
a=xlsread('abc.xls',i,'A(i)');
str=sprintf('%d',a);
set(handles.edit1,'string',str);
end
But i am getting an error:
Error using ==> xlsread at 285
Data range is invalid.
Error in ==> sample>pushbutton1_Callback at 82
a=xlsread('abc.xls',i,'A(i)');
I am new to matlab. Please help.

採用された回答

Vishal
Vishal 2013 年 4 月 23 日
Iman,i am still getting the same error.

その他の回答 (1 件)

Iman Ansari
Iman Ansari 2013 年 4 月 19 日
Hi. Range should be a string:
a=xlsread('abc.xls',i,['A' 'num2str(i)']);
It's better to read the whole file then use it,
a=xlsread('abc.xls',1,'A1:A4');

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by