and better also can specify the distance between the elements, like the 10(g15.7,1x) in Fortran.
Futhermore, if I have another array b which can be any value but still 10 elements. Now I want to display a and b in two lines, but they need to be displayed aligned, like,
println( script for display a)
println ( script for display b )
it is gaussian mixture model, k=1,2.
For each k, I want to show all the results. I want to show them horizontally than vertically.
Because for each k if I need 10 lines, for k=10, if I show them vertically it will take 500 lines which is very inconvenient. But if I show them horizontally, it will only take 10 lines, and it is wide, but is conveneint.
The thing is currently done using Fortran’s format IO, I am still trying to get used to Julia.
Julia vectors are columns, so it makes sense to print them like columns. If you want to have “row”, you can use a single row matrix Matrix{Float64}(undef, 1,10). You won’t be able to push to it (since single element pushing doesn’t make sense for a matrix), so you’ll have to declare it with undef and fill it by indexing.
Not 100% sure what you mean, but are you maybe looking for range(start=1, step=15.7, length=10)?
Check out the Printf stdlib. There’s no function that does what you want out of the box, but it should be fairly easy to achieve what you want with that.
If you are just interested in showing this in the REPL for your own use, you can just transpose the vector, and let Julia display it for you:
jl> a = collect(10.0:10:100.0); # no need for that awkward loop
jl> a'
1Ă—10 adjoint(::Vector{Float64}) with eltype Float64:
10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0
it is gaussian mixture model, k=1,2.
For each k, I want to show all the results. I want to show them horizontally than vertically.
Because for each k if I need 10 lines, for k=10, if I show them vertically it will take 500 lines which is very inconvenient. But if I show them horizontally, it will only take 10 lines, and it is wide, but is conveneint.
The thing is currently done using Fortran’s format IO, I am still trying to get used to Julia.