# [Scilab-users] number od decimals with csvWrite

3 messages
Open this post in threaded view
|

## [Scilab-users] number od decimals with csvWrite

 HiI want to write some data and export them with csvWriteI need to have no more than 2 decimals for aesthetic reasons.How can I set the number of decimals?Thanks,Simone Meroni _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
 The simplest way is to use round A=rand(3,3); B=round(100*A)/100; Serge Steer Le 25/06/2015 22:07, Simone Meroni a écrit : Hi I want to write some data and export them with  csvWrite I need to have no more than 2 decimals for aesthetic reasons. How can I set the number of decimals? Thanks, Simone Meroni ```_______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users ``` _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
 Hi. I suppose no need to use the round function. Use csvWrite: A=rand(3,3); csvWrite(A, 'file_with_A_data.txt', ' ', '.', "%.2e") 7.26e-01 2.32e-01 8.83e-01 1.99e-01 2.31e-01 6.53e-01 5.44e-01 2.16e-01 3.08e-01 By the way, if you want to use a comma as a decimal mark the fourth parameter should be ',': csvWrite(A, 'file_with_A_data.txt', ' ', ',', "%.2e") Stanislav 26.06.2015 12:09, Serge Steer пишет: The simplest way is to use round A=rand(3,3); B=round(100*A)/100; Serge Steer Le 25/06/2015 22:07, Simone Meroni a écrit : Hi I want to write some data and export them with  csvWrite I need to have no more than 2 decimals for aesthetic reasons. How can I set the number of decimals? Thanks, Simone Meroni ```_______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users ``` ```_______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users ``` _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users