Read a string from text file returning strange characters
이전 댓글 표시
I'm reading a string like "1.0.2" from text file with these codes :
reader = fopen('Address\My_Text.txt');
Out= textscan(reader,'%str');
Out1=Out{1} ;
Out2=Out1{1};
fclose(reader);
This code (Out2) returns a string like this: "1.0.2" . This is a text file that copied by MATLAB from other place in HDD (The main file is working correctly). When I create a text file manually, insert "1.0.2" in it, These codes read this value correctly. What is the problem? What is the solution for MATLAB?
Thanks.
댓글 수: 2
Geoff Hayes
2014년 8월 2일
Jack - what do you mean by text file that copied by MATLAB from other place in HDD? Do you mean that you have some MATLAB code that copied the file? If so, what does that code look like?
채택된 답변
추가 답변 (1개)
John
2014년 8월 3일
0 개 추천
Play around with the EncodingIn key value pair for the fopen function. Chances are its opened in the wrong encoding mode.
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!