In [1]:
using Dates
include("printmat.jl") #a function for prettier matrix printing
Out[1]:
In [2]:
fh = open("Results/NewTxtFile.txt", "w") #open the file, "w" for writing
println("NewTxtFile.txt has been created in the subfolder Results. It's still empty.")
In [3]:
println(fh,"Dogs are ") #printing to the file, notice the fh
println(fh,"nicer than cats.")
println(fh,"\n")
x = reshape(1:20,5,4)
printmat(fh,x,width=10,prec=0) #to pretty print the matrix
In [4]:
close(fh) #close the file
println("NewTxtFile.txt has been closed. Check it out.")
In [ ]: