xlsread not able to reference my sheet names.

조회 수: 10 (최근 30일)
Chameleon17
Chameleon17 2016년 1월 6일
댓글: Image Analyst 2016년 1월 7일
Good afternoon,
I've never had this problem before, I'm certain it must be a pretty easy fix.
I'm trying to open an excel file, using xlsread. I have my program on a loop though specifying that each pass it should use a sheet of a different name. It keeps telling me though that the sheet name does not exist, but when I use xlsinfo it tells me that the sheet name is there.
DATA = xlsread('DATA1', 12)
I'm just a bit stumped as to how to get around this.
Any advice would be very much appreciated!
Thanks
  댓글 수: 2
Stephen23
Stephen23 2016년 1월 6일
편집: Stephen23 2016년 1월 6일
@Chameleon17: for this forum please don't put leading space characters in front of each line of your text, because this will be formatted as monospaced text (i.e. code). I just removed your leading space characters, and you can see now how the text of your question is normal text.
Renato Agurto
Renato Agurto 2016년 1월 6일
I that the actual command you are using? where are you writing the filename? You also have to write the sheet name OR the number, not both

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

답변 (2개)

Image Analyst
Image Analyst 2016년 1월 6일
Are you sure you have 12 worksheets in the workbook? Have you tried using the name of the sheet instead of it's number? Can you attach the data.xlsx workbook file to your posting with the paperclip icon?
  댓글 수: 4
Image Analyst
Image Analyst 2016년 1월 6일
I saw you just posted that this did not work. However, I'm not seeing your workbook attached anywhere so that anyone can try it. Are you able to do that? You can take out any proprietary numbers and strings if you want first.
Image Analyst
Image Analyst 2016년 1월 7일
Are you sure it's twelve and not (capital i)2?

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


Renato Agurto
Renato Agurto 2016년 1월 6일
편집: Renato Agurto 2016년 1월 6일
The name of the sheet should be a string. You should use then:
DATA = xlsread('DATA1.xlsx', '12')
If you use a number it will select the sheet number 12 (if you have 12 sheets or more of course)
  댓글 수: 3
Renato Agurto
Renato Agurto 2016년 1월 6일
can you post the results of:
[status, sheets] = xlsfinfo('DATA1.xlsx')
and the error message of:
DATA = xlsread('DATA1.xlsx', '12')
Walter Roberson
Walter Roberson 2016년 1월 6일
After you run the above, please also post
sheets{1}, (sheets{1}+0)
so we can check for unexpected characters in the name.

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

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by