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,'.',',')
更多回答(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!