필터 지우기
필터 지우기

xlsread on Mac in basic mode

조회 수: 4 (최근 30일)
Angry Sloth
Angry Sloth 2013년 11월 5일
답변: Marc 2013년 11월 12일
I'm having issues with the xlsread function. I am using Matlab and excel in Mac OSX. So far I understand that in the Mac environment, Matlab must use basic mode to import. I thought I'd accounted for this in my script. I've also changed the file type of the source excel workbook to be 98 compatible
This is the content of my script:
_clc clear
[num,txt,raw] = xlsread('VSim.xls','Sheet1','','basic')_
This is the displayed error messages:
_Warning: XLSREAD has limited import functionality on in basic mode. Refer to HELP XLSREAD for more information. > In xlsread at 168 In exc at 4 Error using xlsread (line 232) XLSREAD unable to read sheet Sheet1. File could not be read by biffparse. Invalid record ID.
Error in exc (line 4) [num,txt,raw] = xlsread('VSim.xls','Sheet1','','basic')_
Thanks in advance.
Is there any solution to this problem?
Chris

답변 (2개)

Ken Atwell
Ken Atwell 2013년 11월 6일
What version of MATLAB are you using? The last handful of releases can read .xlsx files, give it a try.
  댓글 수: 2
Angry Sloth
Angry Sloth 2013년 11월 8일
Im using 2011 on my mac. Im trying the xlsread function and the same thing happens all the time... It works whenever I do it with windows but it just doesn't seem to work on my mac.
Ken Atwell
Ken Atwell 2013년 11월 12일
Gotcha. The XLSX support I am referring to was added in R2012a, sorry.

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


Marc
Marc 2013년 11월 12일
You are not going to like this answer. I am using Mac OS X 10.8.5, Office for Mac 2011. When I was developing this "code", it was with 2012b on Windows 7 at work. Since my license allows me to work at home, I tried it on my Mac. To get it to work, I saved the excel file as a .xlsm extension. So, here are the errors I get for 2010a, 2012b and 2013b depending on the file extension.
2010a gives me an error whether I save the file as .xls or .xlsm. .xlsm error first...
% -----------------------------------------------------------------------------------------
Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 184 In unit9_dataReadRaw at 13 ??? Error using ==> xlsread at 234 File contains unexpected record length. Try saving as Excel 98.
Error in ==> unit9_dataReadRaw at 13 [data{i},text{i}] = xlsread(filename, sheets{i}, 'A1:S130');
% -------------------------------------------------------------------
2010a with an .xls file extension
% -------------------------------------------------------------------
Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 184 In unit9_dataReadRaw at 13 Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 184 In unit9_dataReadRaw at 13 Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 184 In unit9_dataReadRaw at 13 Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 16 Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 17 ??? Error using ==> xlsread at 234 XLSREAD unable to read sheet LOADING. File contains unexpected record length. Try saving as Excel 98.
Error in ==> unit9_dataReadRaw at 17 [loadDat, loadText] = xlsread(filename, 'LOADING');
% ------------------------------------------------------------
In 2012b, the only error I get is with the .xls file
Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 199 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 199 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 199 In unit9_dataReadRaw at 13 Error using xlsread (line 247) XLSREAD unable to read sheet 'LOADING'. File contains unexpected record length. Try saving as Excel 98.
Error in unit9_dataReadRaw (line 17) [loadDat, loadText] = xlsread(filename, 'LOADING');
>>
% -----------------------------------------------------------------
In 2013b, looking for the .xls file, I get the following error. Both 2012b and 2013b give me no issues with the same file saved as .xlsm.
Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 201 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 201 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 201 In unit9_dataReadRaw at 13 Error using xlsread (line 248) XLSREAD unable to read sheet 'LOADING'. File contains unexpected record length. Try saving as Excel 98.
Error in unit9_dataReadRaw (line 17) [loadDat, loadText] = xlsread(filename, 'LOADING');
% --------------------------------------------------------------------
As you can see the errors point to different lines in 2012b and 2013b. I try not to think about it when I go to sleep. A nice 12 year old scotch helps.....

카테고리

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