Trouble importing data from excel file using xlsread

1 回表示 (過去 30 日間)
Nicholas
Nicholas 2011 年 2 月 20 日
I am having trouble importing data from excel file using xlsread. I attempt as follows:
ndata = xlsread('C:\Documents\oput021m.xlsx', 'F2:F3');
And get the following error:
??? Error using ==> xlsread at 219 XLSREAD unable to open file C:\Documents\oput021m.xlsx. File C:\Documents\oput021m.xlsx not found.
I have even tried opening a file with the .xls extension and continue to get the same error. The file is in the location that is specified, so I am not sure what is going wrong. Could someone please help me out? Thanks.

採用された回答

Jiro Doke
Jiro Doke 2011 年 2 月 20 日
What do you get when you type
exist('C:\Documents\oput021m.xlsx', 'file')
Does it return 2? If 0, then you mistyped the filename. Make sure you have the correct extension. For Excel files, it could also be .xlsm, .xls, .xlsb.

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 2 月 20 日
I don't know, but I would suggest experimenting with
[fid, status] = fopen('C:\Documents\oput021m.xls','rt');
and then examining the status variable.

Nicholas
Nicholas 2011 年 2 月 21 日
Thanks. Although I got the address from properties, this code gave me a zero.
I changed the location and used the new address. It worked.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by