Reading excel file in MATLAB (GUI)

4 ビュー (過去 30 日間)
Samer Husam
Samer Husam 2012 年 5 月 29 日
Hi, I want to read two values in an excel sheet and sum these values by pressing (Push_button) but I am getting an (??? XLSREAD unable to open file Data_sheet.xls.) and stating that the file is not found. my code is :
a=xlsread(G:\Master\Program\Calculator\Data_sheet.xls,'B5′);
b=xlsread(G:\Master\Program\Calculator\Data_sheet.xls,'B6′);
c=a+b;
set(handles.text1,'string',c);
why I am having this error? and how can I come over it ? please help ?

採用された回答

Samer Husam
Samer Husam 2012 年 5 月 29 日
a=xlsread(G:\Master\Program\Calculator\Data_sheet.xls,'Sheet1','B5′);
b=xlsread(G:\Master\Program\Calculator\Data_sheet.xls,'Sheet1','B6′);
c=a+b;
set(handles.text1,'string',c);

その他の回答 (2 件)

Samer Husam
Samer Husam 2012 年 5 月 29 日
any suggestions please ?

Vishnu Swaroop
Vishnu Swaroop 2012 年 6 月 4 日
put the file in your matlab folder and say : a=xlsread('Data_sheet.xls')
This should work out fine, but using 'B5' like that won't help. Try instead: a=xlsread('Data_sheet.xls','B5:B6')
This should give 'a' as an array with the two elements that you want to add as : c=a(1)+a(2)
Hope this helps.

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by