One way is to round the data prior to writing it:

julia> a = rand(10,5)
10x5 Array{Float64,2}:
 0.806913  0.010713  0.469981  0.419839   0.451575
 0.584154  0.720939  0.444952  0.756981   0.0928572
 0.204909  0.36935   0.122733  0.777961   0.291004
 0.784125  0.490603  0.312298  0.0527099  0.21626
 0.953513  0.245063  0.373179  0.778251   0.127561
 0.102803  0.371336  0.52819   0.652244   0.487652
 0.384086  0.540702  0.431661  0.518019   0.964562
 0.544121  0.732757  0.270263  0.258582   0.615142
 0.517202  0.269335  0.755445  0.390461   0.266775
 0.695753  0.505792  0.508295  0.707993   0.168138


julia> writecsv("testrounded.csv", round(a,3))

shell> cat testrounded.csv
.807,.011,.47,.42,.452
.584,.721,.445,.757,.093
.205,.369,.123,.778,.291
.784,.491,.312,.053,.216
.954,.245,.373,.778,.128
.103,.371,.528,.652,.488
.384,.541,.432,.518,.965
.544,.733,.27,.259,.615
.517,.269,.755,.39,.267
.696,.506,.508,.708,.168


On Tuesday, May 10, 2016 at 11:16:50 AM UTC-7, Jorge Fernández de Cossío 
Díaz wrote:
>
> Is it possible to specify format in writedlm?
>
> Specifically, I want to write a matrix of Floats to a file, but I am only 
> interested in saving a few digits after the decimal point, anything else 
> would take too much disk space for no good reason.
> Is there a way to do this?
>

Reply via email to