Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export data from matlab to csv [duplicate]

Tags:

matlab

I am trying to use matlab's csvwrite to write an array to a csv file. However, matlab writes the data in the format like 2.008e+09. I don't want it to write in the e+09 form but the whole number expanded. How can I do it?

like image 275
user34790 Avatar asked Aug 25 '13 12:08

user34790


People also ask

How do I export data from MATLAB to CSV?

csvwrite( filename , M ) writes matrix M to file filename as comma-separated values. csvwrite( filename , M , row , col ) writes matrix M to file filename starting at the specified row and column offset. The row and column arguments are zero based, so that row=0 and col=0 specify the first value in the file.

How do I export data from MATLAB to excel?

To export a table in the workspace to a Microsoft® Excel® spreadsheet file, use the writetable function. You can export data from the workspace to any worksheet in the file, and to any location within that worksheet. By default, writetable writes your table data to the first worksheet in the file, starting at cell A1 .

How do I export output from MATLAB?

You can export a cell array from MATLAB® workspace into a text file in one of these ways: Use the writecell function to export the cell array to a text file. Use fprintf to export the cell array by specifying the format of the output data.


1 Answers

csvwrite writes a maximum of 5 significant digits.

Use dlmwrite instead :

dlmwrite('test.csv',your_data, 'precision', 9) ; % 9 significant figures.
like image 157
P0W Avatar answered Sep 28 '22 18:09

P0W