f = open("myfile.csv","w")
for i in 1:length(data)
write(f,@sprintf("%20.16f\n",data[i]))
end
close(f)
shell> cat myfile.csv
-0.5000000000000000
0.0000000000000000
-0.0000218199000000
0.0000153967000000
-0.0000178990000000
0.0000126717000000
-0.0000022432700000
0.0000016008700000
Op vrijdag 24 juni 2016 04:55:37 UTC+2 schreef Hoang-Ngan Nguyen:
>
> Hi,
>
> I have the following array
> data = [
> -0.5
> 0.0
> -2.18199e-5
> 1.53967e-5
> -1.7899e-5
> 1.26717e-5
> -2.24327e-6
> 1.60087e-6]
>
>
> When I save it using either
>
> writecsv("filename.csv",data)
>
> or
>
> writedlm("filename.csv",data,",")
>
>
> I get this
> -.5
> 0
> -21819881018654233e-21
> 153966589305464e-19
> -17898976869144106e-21
> 12671715235247999e-21
> -22432716786997375e-22
> 16008706220269127e-22
>
> Is there anyway for me to, instead, get the following:
> -.5
> 0
> -.000021819881018654233
> .0000153966589305464
> -.000017898976869144106
> .000012671715235247999
> -.0000022432716786997375
> .0000016008706220269127
>
> Thanks,
> Ngan
>
>