I need to convert comma ',' to dot '.'
61 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have a set of txt files that contain only a set of numbers that have decimals, but have a comma and not a dot as a separator (for example, there is 1567,987 and not 1567.987). Is there a script that allows you to do this conversion?
I could use matlab's "find & replace" option and import the files later, however, since there are so many files I would like to do something more automated with a script.
1 件のコメント
Stephen23
2021 年 6 月 10 日
If your actual goal is to import the data then READTABLE et al will correctly parse files with decimal commas:
回答 (2 件)
Sulaymon Eshkabilov
2021 年 6 月 10 日
編集済み: Jan
2021 年 6 月 10 日
Check out this very sweet answer given by Jan:
2 件のコメント
Star Strider
2021 年 6 月 10 日
One option in detectImportOptions (introduced in R2016b and updated in later releases) in Parameters for Text Files Only allows the definition of:
'ThousandsSeparator' — Characters that indicate the thousands grouping
and:
'DecimalSeparator' — Characters indicating decimal separator
There is no direct URL for these, so click on the second link and scroll down to them.
.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!