Matlab: How to read in numbers with a comma as decimal separator?

前端 未结 4 1574
礼貌的吻别
礼貌的吻别 2020-12-03 23:47

I have a whole lot (hundreds of thousands) of rather large (>0.5MB) files, where data are numerical, but with a comma as decimal separator. It\'s impractical for me to use a

4条回答
  •  囚心锁ツ
    2020-12-04 00:31

    You may use txt2mat.

    A = txt2mat('data.txt');
    

    It will handle the data automatically. But you can explicitly say:

    A = txt2mat('data.txt','ReplaceChar',',.');
    

    P.S. It may not be efficient, but you can copy the part from the source file if you need it only for your specific data formats.

提交回复
热议问题