Formatted printing of arrays

In theory you can do something like this:

julia> a = randn(4, 4)
4×4 Array{Float64,2}:
 -1.93222    -0.427925  -0.502227   0.522741
  0.240474   -1.13067    1.68355    0.839821
  1.79882     0.918598   1.28506   -1.38715 
  0.0540847   0.197535  -0.204077  -0.282407

julia> Base.show(io::IO, f::Float64) = @printf io "%1.3f" f

julia> a
4×4 Array{Float64,2}:
 -1.932  -0.428  -0.502   0.523
  0.240  -1.131   1.684   0.840
  1.799   0.919   1.285  -1.387
  0.054   0.198  -0.204  -0.282

but I don’t know whether it’s recommended, or indeed how to undo it… :slight_smile:

5 Likes