Matlab cannot read data from a file which is saved as a text-file from Excel

조회 수: 2 (최근 30일)
G A
G A 2012년 6월 1일
I am not able to load data from a file which was saved as a text-file from MS Excel. textscan and load return an empty matrix. I tried to retype the data within the file using MS Notebook, to save the file with new name, however without success. If I open a new text-file with MS Notebook and copy-paste there the data from the file saved from Excel, then there is no problem with reading. Why?
  댓글 수: 2
laurie
laurie 2012년 6월 1일
are you sure the format (UTF..) of your text-fil from Excel is the right one ? textscan as a "format" parameter i believe
G A
G A 2012년 6월 2일
I have checked this again. This happens if you save data from Excel as Unicode Text. If you save the data as Text (Tab delimited) - everything is OK.

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

답변 (1개)

per isakson
per isakson 2012년 6월 2일
You need to set the input argument, encoding, of fopen. There are many alternatives including "Unicode".
  댓글 수: 4
G A
G A 2012년 6월 3일
I am using Office 2010 and Matlab 2011b
G A
G A 2012년 6월 3일
I have tried
fopen(filename,'r','n','windows-1251')
varying encodings, however it has not solved the problem

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

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by