Invalid or Empty Spreadsheet error ?

Greetings everyone,
I am beginner in Matlab and currently using Matlab R2013a.
I need to import a excel file into Matlab. So, I use the Import Data button and select the file I want to import. But in Matlab, a message appears that "the spreadsheet is invalid or empty" !!! And there is surely data present in the spreadsheet. I really don't know how to resolve this. Need help ASAP !!!
Regards, Abhik Das

3 件のコメント

Image Analyst
Image Analyst 2014 年 9 月 19 日
Can you attach your workbook so we can try it ourselves?
Abhik Das
Abhik Das 2014 年 9 月 20 日
Oh sure, I am attaching the file here :
Image Analyst
Image Analyst 2014 年 9 月 23 日
That's not an Excel workbook, it's a simple text file. How did you try to read it in? With xlsread()? Or some other function?

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2014 年 9 月 20 日

0 投票

Use testscan. It will read it without problems:
fidi = fopen('S17_R1.xls');
D = textscan(fidi, '%f %f', 'HeaderLines',2);
produces ‘D’ as a (1x2) cell:
D =
[502x1 double] [502x1 double]

5 件のコメント

Abhik Das
Abhik Das 2014 年 9 月 22 日
Thanks for your answer sir. But I am still not able to import the file when I directly copy-paste your command into Matlab and execute it. Can you please check the excel file attached and guide me step by step ? As I newbie, I have very little experience with Matlab.
Star Strider
Star Strider 2014 年 9 月 22 日
What error do you get?
It worked for me with your file and with the code I posted.
Abhik Das
Abhik Das 2014 年 9 月 23 日
this is the error sir : Error using textscan Invalid file identifier. Use fopen to generate a valid file identifier.
:(
Guillaume
Guillaume 2014 年 9 月 23 日
Most likely, fidi equal -1, meaning the file was not found. Check the filename, and that the file is in the current matlab folder.
Star Strider
Star Strider 2014 年 9 月 23 日
Be sure the file is either in your MATLAB user folder (or somewhere in the MATLAB search path), or that you provide the full path to the file.

サインインしてコメントする。

質問済み:

2014 年 9 月 19 日

コメント済み:

2014 年 9 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by