0

I used csvwrite function. The original input vector's elements increase by 0.001: 0 , 001, 002....but when I save it as csv file the excel shows values like this at bigger numbers: 99.999, 100, 100, 100, etc. Changing the data format in excel doesn't solve the problem. Any suggestions?

jacky
  • 73
  • 7
  • 2
    1. CSV is a text format; verify loss of precision in a text editor. Excel is not acclaimed for accuracy. 2. As was already mentioned, csv is a text format. You can write arbitrarily precise data using a text file function (such as fprintf), adding commas as necessary. – X Zhang Dec 02 '22 at 14:55

1 Answers1

1

According to its help page, csvwrite has the following limitations:

csvwrite writes a maximum of five significant digits. If you need greater precision, use dlmwrite with a precision argument.

However, both functions are no longer recommended by MathWorks, but the use of writetable, writematrix, or writecell is encouraged instead.

ylpjört
  • 128
  • 7