필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

xlsread returns error some times

조회 수: 1 (최근 30일)
Christian F.
Christian F. 2015년 3월 12일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I have a little Problem with xlsread. When I use xlsread to import data, I sometimes get the error message:
Error using xlsread (line 247)
File C:\Users\...\UK.xls not in Microsoft Excel Format.
The file exists and the file name is correct. When I run the code a couple of times, it usually works. So the error occurs only some times. Any suggestions how to fix this?
Thanks in advance!
  댓글 수: 2
BSantos
BSantos 2015년 3월 12일
Can you shows us a bit of your code where the error is being generated?
Image Analyst
Image Analyst 2015년 3월 12일
Does it open using Excel? Can you attach the workbook here so someone can try it? Can you attach your script? Can we just put xlsread() in a for loop and observe the problem on some iterations?

답변 (1개)

Christian F.
Christian F. 2015년 3월 12일
편집: Christian F. 2015년 3월 12일
Some code:
fname=strcat('C:\Users\...\',country); T = length(vector);
firstRow = 1; lastRow = T; firstCol = 'B'; lastCol = 'C'; cellRange = [firstCol,num2str(firstRow),':',lastCol,num2str(lastRow)]; [~,~,unique_geo_labels_new] = xlsread(fname,'Tabelle1',cellRange);
As I said before, some times it works, some times it doesn't. Very strange.
  댓글 수: 2
BSantos
BSantos 2015년 3월 12일
One thing I notice is that you assign lastRow as T but not within commas; lastRow = T -> lastRow = 'T'
Plus, you do num2str(lastRow), but lastRow is not a number on th ecode you just shared.
Other than that, I don't see why xlsread does not work....
Christian F.
Christian F. 2015년 3월 12일
Excuse me, T is simply defines as the number of rows I want to import, so it's numeric.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by