logo

How to Print Without Omitting Data in Julia 📂Julia

How to Print Without Omitting Data in Julia

Overview

Originally, Julia formats the data output to fit the size of the REPL beautifully, but sometimes we want to see the entire data comfortably. If the data is foo, you can print the entire data using show(stdout, "text/plain", foo)1.

Code

julia> foo = rand(100,2)
100×2 Matrix{Float64}:
 0.956438   0.663427
 0.790117   0.472821
 0.976134   0.198475
 0.727601   0.472336
 0.0469046  0.991999
 0.625807   0.26634
 0.490773   0.588481
 0.352966   0.426474
 0.585632   0.00185974
 ⋮
 0.615713   0.707071
 0.891683   0.622176
 0.370576   0.937107
 0.430644   0.0439135
 0.535987   0.551992
 0.43273    0.217023
 0.345366   0.500033
 0.551719   0.0761454

Originally, is printed like above, but if it is printed in plain text, the entire data prints out as follows.

julia> show(stdout, "text/plain", foo)
100×2 Matrix{Float64}:
 0.956438    0.663427
 0.790117    0.472821
 0.976134    0.198475
 0.727601    0.472336
 0.0469046   0.991999
 0.625807    0.26634
 0.490773    0.588481
 0.352966    0.426474
 0.585632    0.00185974
 0.13357     0.90977
 0.789999    0.137833
 0.11626     0.385958
 0.629265    0.40623
 0.111327    0.483414
 0.22717     0.0960839
 0.854027    0.690618
 0.00862816  0.426555
 0.292845    0.588308
 0.475157    0.935968
 0.936422    0.116917
 0.421748    0.335614
 0.354324    0.444122
 0.52423     0.311464
 0.306786    0.873037
 0.308008    0.70787
 0.0885757   0.558464
 0.0510476   0.840701
 0.320569    0.28571
 0.89837     0.517027
 0.218359    0.622536
 0.563148    0.488849
 0.508919    0.818068
 0.880726    0.550501
 0.555517    0.953056
 0.466298    0.29687
 0.816757    0.528656
 0.789289    0.294199
 0.51256     0.173814
 0.972556    0.11602
 0.438784    0.815105
 0.218237    0.257226
 0.0838205   0.535666
 0.287095    0.877342
 0.176927    0.942882
 0.855193    0.577759
 0.813356    0.488643
 0.407358    0.970933
 0.224252    0.455783
 0.430215    0.727
 0.0585314   0.727251
 0.77538     0.777196
 0.114963    0.610359
 0.445436    0.472755
 0.0565616   0.153393
 0.695217    0.00669471
 0.673818    0.284351
 0.308611    0.386984
 0.761394    0.32279
 0.017963    0.114759
 0.465956    0.788791
 0.970691    0.264864
 0.0953205   0.359958
 0.437556    0.283858
 0.323666    0.893141
 0.971015    0.109052
 0.117792    0.919322
 0.898883    0.947123
 0.248386    0.462831
 0.895525    0.434108
 0.526593    0.288652
 0.891208    0.848443
 0.344758    0.412774
 0.697527    0.592066
 0.531953    0.50251
 0.0565245   0.449993
 0.168528    0.783811
 0.129681    0.22014
 0.489568    0.232417
 0.875734    0.380527
 0.0207026   0.915546
 0.210948    0.476037
 0.822661    0.517793
 0.579839    0.0221691
 0.455027    0.920253
 0.932968    0.771582
 0.960643    0.841065
 0.0835567   0.943408
 0.578494    0.502968
 0.0655954   0.528926
 0.590831    0.41364
 0.840604    0.790515
 0.327964    0.269113
 0.615713    0.707071
 0.891683    0.622176
 0.370576    0.937107
 0.430644    0.0439135
 0.535987    0.551992
 0.43273     0.217023
 0.345366    0.500033
 0.551719    0.0761454

Environment

  • OS: Windows
  • julia: v1.7.0