I am creating a logging function and need to create a string for the values of a bunch of arrays at some intermediate points (to both print and save to a file). I was using the following to save the arrays Ai
, Bi
, α
, and βi
:
resString = """
A₀ = $A0
A₁ = $A1
B₀ = $B0
B₁ = $B1
α = $α
β₁ = $β1
β₂ = $β2
β₃ = $β3
β₄ = $β4
"""
but interpolation doesn't give you the full precision and I need to save the arrays at full precision. Is there an easy way to modify this so that way all of the strings show the full values for the numbers?
Is this what you want?
join(string.(A0), ",")
or
"[$(join(string.(A0), ","))]"
if you need the square brackets too.
If you have a look here (julia/base/strings/string.jl) you can probably work out why!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With