필터 지우기
필터 지우기

textscan not reading file properly

조회 수: 1 (최근 30일)
Benson
Benson 2013년 7월 1일
I have used textscan successfully in this manner for other files (different file extension). I am not sure why it does not work for this excel sheet (.xlsx). It is telling me that M = [0x1 double] [0x1 double].
clear
fid=fopen('data.xlsx');
M = textscan(fid,'%n%n')
fclose(fid);
Any help is appreciated. Thanks!
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 7월 2일
Which MATLAB release are you using, and which operating system? If you are on MS Windows, which version of Excel do you have installed ?
per isakson
per isakson 2013년 7월 2일
textscan cannot read an xlsx-file. It isn't text.

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

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 7월 1일
M=xlsread('data.xlsx');
  댓글 수: 2
Benson
Benson 2013년 7월 1일
I have tried that, but I get "Unable to read XLS file C:\Users\Benson\Desktop\Princeton13 Documents\ECData\data.xlsx. File is not in recognized format."
I have also tried editing the file extension to data.xls, but I get the same error.
per isakson
per isakson 2013년 7월 2일
Open and close the file with Excel.

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


per isakson
per isakson 2013년 7월 2일
편집: per isakson 2013년 7월 2일
Could it be that the cells in Excel are defined as right-justified text? Try
[num,txt,raw] = xlsread('data.xlsx')
and inspect all three outputs.
Which versions of Excel and Matlab do you use?

카테고리

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