Problem loading excel file into MATLAB

조회 수: 1 (최근 30일)
Paul T John
Paul T John 2011년 8월 17일
Hi,
I'm facing a problem in loading Excel data into MATLAB. It says:
??? Index exceeds matrix dimensions.
Error in ==> importdata>readFromExcelFile at 720 out = subsasgn(out, [substruct('.', 'colheaders') baseSubs{i}], s(likely_row, :));
Error in ==> importdata at 152 out = readFromExcelFile(FileName, descr, out, bFlatten);
Error in ==> test at 8 worksheet = importdata (location); %Loads data from the specified location
The problem is for only certain files, while other similar files work fine. Does anyone know how to tackle this?
P.S: Excel 2010, OS: Windows 7
Thanks.

답변 (2개)

Jan
Jan 2011년 8월 17일
What is the difference between the working and not working files? While you have the possibilities to find it, we can only guess.
You can enable the debugger to find out more details:
dbstop if error
Then MATLAB stops, if the error occurs, and you can inspect the values of the local variables "baseSubs", "i", "s" and "likely_row".
  댓글 수: 1
Paul T John
Paul T John 2011년 8월 17일
There is no difference between the working and non-working files except they are different in their entries.
Both kinds have their columns headers same. I think the problem is with the headers and got around it by using
numeric = xlsread(file) instead of
worksheet = importdata (filename)

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


Friedrich
Friedrich 2011년 8월 17일
Hi,
are you using the Import Wizard or importdata function together with R2009b? If so, thats a known Bug. You can use xlsread instead and it will work just fine.
Or you can contact the Technical Support which should have a patch for this.
  댓글 수: 2
Paul T John
Paul T John 2011년 8월 17일
Known bug? Probably. But it [importdata] works for some files which are of the same kind.
Friedrich
Friedrich 2011년 8월 17일
That wasn't a guess. This bug happens in R2009b only. If you want a patch contact TS.

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

카테고리

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