How to open a file in MATLAB, which has comma as decimal separator.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jesus
am 15 Okt. 2013
Kommentiert: Jesus
am 20 Okt. 2013
How to open a file (.txt or.dat), which has comma as decimal separator. My file has two columns (the first column is using comma as decimal separator). The two columns of the file are separated by space. My file looks like this:
1,94534 228
1,94534 231
1,97364 228
1,97364 231
2,00235 228
2,00235 231
2,00235 234
2,03148 228
2,03148 231
2,03148 234
2,06103 231
2,06103 234
2,09101 228
2,09101 231
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 15 Okt. 2013
Bearbeitet: Azzi Abdelmalek
am 15 Okt. 2013
Edit
fid=fopen('file.txt')
s=textscan(fid,'%s %s')
fclose(fid)
v1=str2double(strrep(s{1},',','.'))
v2=str2double(s{2})
2 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu File Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!