read replace decimals ,. commas to dot from txt files

Hi there I am trying to import a file but the %%f%ff got commas as for decimals not possible to import if not had not written with dot. how can I replace thein in txt file?

回答(3 个)

The comma is an issue in Matlab, could you use dots instead?
-0.229447 0.003749 0.003599
-0.056431 2.009800 1.003600
-0.229128 0.004065 0.004236
-0.228810 0.004382 0.003599
If 'data.txt' is your containing file, the following should work:
fid = fopen('data.txt');
my_data = fscanf(fid, '%f %f %f', [3 4]);
fclose(fid);
files are exported from labview in txt, are saved with commas, I think I will reach a solution exporting data from LB, dots and commas create problems as because in Europe to US the use of comma-dot in numers is different.
There is any solution to modify, in Matlab the %f number recognison with commas? dude so I hope and search:)

类别

帮助中心File Exchange 中查找有关 Standard File Formats 的更多信息

提问:

2013-7-12

编辑:

2015-12-14

Community Treasure Hunt

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

Start Hunting!

Translated by