How do I read commas as decimal points when reading a text file?
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a file that I'm trying to read with numerical values that use commas as decimal points. For example...
0 21,875000 120,700000 0,000000
instead of...
0 21.875000 120.700000 0.000000
I've used textscan to read and parse lines in other files.
line = fgetl(fid);
data = textscan(line,'%d %n %n %n',1,'delimiter','\n');
Can I get Matlab to recognize the commas as decimal points?
댓글 수: 0
채택된 답변
Paulo Silva
2011년 4월 7일
after reading the file replace the decimal points by commas
data=strrep(data,'.',',')
댓글 수: 1
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!