Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
xlsread error (mac): "unexpected record length"

Subject: xlsread error (mac): "unexpected record length"

From: Eric

Date: 15 Nov, 2008 22:55:05

Message: 1 of 4

Hi there.
I recently just switched to a Mac and am encountering some new problems. xlsread is giving me the error:
"File contains unexpected record length. Try saving as Excel 98."

The files are actually excel 97-04 so that shouldn't be the problem. I also have successfully read in some of the excel files. I have meteorological data from 20 sites and the spreadsheets are essentially identical but most of them give me this error.

I've tried re-saving the xls files, copying and pasting into a new file and copying a smaller portion of the file into a new file. None of the above worked and these were suggestions I got when searching other forums.

I did notice that regardless of the files being identical (same fields and rows just different values) the file size varies greatly. I'm wondering if the files may be corrupt in some way? even though I can open them and everything seems to be there/ nothing missing.

Any help would be greatly appreciated

Thanks

-eric

Subject: xlsread error (mac): "unexpected record length"

From: jawadkcl

Date: 8 Aug, 2009 22:14:02

Message: 2 of 4

Hi,
Did you find a solution to this? I've recently installed matlab & am getting exactly the same problem. Ican't seem to get an excel spreadsheet to load. It was fine on a colleague's PC.

Jawad

"Eric " <ecwhite@ucalgary.ca> wrote in message <gfnk09$bbi$1@fred.mathworks.com>...
> Hi there.
> I recently just switched to a Mac and am encountering some new problems. xlsread is giving me the error:
> "File contains unexpected record length. Try saving as Excel 98."
>
> The files are actually excel 97-04 so that shouldn't be the problem. I also have successfully read in some of the excel files. I have meteorological data from 20 sites and the spreadsheets are essentially identical but most of them give me this error.
>
> I've tried re-saving the xls files, copying and pasting into a new file and copying a smaller portion of the file into a new file. None of the above worked and these were suggestions I got when searching other forums.
>
> I did notice that regardless of the files being identical (same fields and rows just different values) the file size varies greatly. I'm wondering if the files may be corrupt in some way? even though I can open them and everything seems to be there/ nothing missing.
>
> Any help would be greatly appreciated
>
> Thanks
>
> -eric

Subject: xlsread error (mac): "unexpected record length"

From: oscaro@shaw.ca

Date: 23 Apr, 2013 21:03:18

Message: 3 of 4

Did you ever find a solution? I am having the same problem, one file it works for and an essentially identical file (from the same template, saved with slightly different numbers on a different date).

Joel K



On Saturday, November 15, 2008 2:55:05 PM UTC-8, Eric wrote:
> Hi there.
> I recently just switched to a Mac and am encountering some new problems. xlsread is giving me the error:
> "File contains unexpected record length. Try saving as Excel 98."

Subject: xlsread error (mac): "unexpected record length"

From: Marc

Date: 24 Apr, 2013 04:50:10

Message: 4 of 4

oscaro@shaw.ca wrote in message <388cc077-d003-4ecb-ae1f-b308eb8b5379@googlegroups.com>...
> Did you ever find a solution? I am having the same problem, one file it works for and an essentially identical file (from the same template, saved with slightly different numbers on a different date).
>
> Joel K
>
>
>
> On Saturday, November 15, 2008 2:55:05 PM UTC-8, Eric wrote:
> > Hi there.
> > I recently just switched to a Mac and am encountering some new problems. xlsread is giving me the error:
> > "File contains unexpected record length. Try saving as Excel 98."

What version of Matlab and excel are you using on Mac? Any relevant code that produces this error.

Many things have changed since 2008/2009. The most recent Matlab version with Office 2011 for Mac seem to give reproducible results as long as the excel file is saved as xlsx or xlsm extension.

Way back when, on a PC, I got some weird results with xlsread due to an excel add on my company pushed on a new computer. So, if you have any macros or add ons in your excel files, this may throw Matlab off.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us