As shown in the screenshot, the variable is a column vector which is showing correctly in Excel (e.g., I use Excel to open the x0.txt Julia generated.). It is showing incorrectly in windows notepad program.
What should I do to make the txt file look correct?
I tried your suggested code. It gives the same results as mine.
Please see the screenshot. I want the txt file to display the results in a column instead of a row.
Specifically, it should have a new line command for each row.
The screenshot show the txt file is a column when I use Excel to open it.
But it is a row in the txt file.
I want to print the above 2D array into txt file with the following code:
y=rand(9,4);
s=size(y);
io=open("a4.txt","w") do io
for i=1:s[1]
for j=1:s[2]
if j < s[2]
println(io, y[i,j],"\t")
else
println(io, y[i,j],"\n")
end
end
end
end
Then I got this output in VS code. How can get this 2D array output correctly?