How to store all in Julia

Could please tell me i want to save all output. what should i do. I tried use CVS and Excel but i could not.
It means should i create file for each loop i wrote (println) or what.

JLD.jl

JLD2.jl

Thank you for your reply. I would like to ask you I have many loops and arrays I am not sure how can i save it.

I don’t understand what you mean. Maybe someone else can help.

Have you tried reading the documentation from the packages that @mkitti shared? You should find examples there that are similar to your case.

For example, here is the documentation for JLD2: Basics · Julia Data Format

Do you want to store all output you see while running the program? Or all global variables? Or something else?

1 Like

Thank you for your reply i want to store all output.

It would be very helpful if you write some pseudo-code (code that does not run), where the names of variables and functions show us what you want to happen :slight_smile:

1 Like

Specifically, it is not clear what you mean by “store all output,” or what loops and arrays have to do with anything. Does “store all output” mean “save the everything that appears in the REPL to a file,” like Matlab’s “diary on”? If not that, what?

To get help your question needs to be clear enough for people to understand what you’re talking about. An example of some code and what you want stored from it would be ideal.

Maybe logging the output to a file is what you’re looking for? Logging · The Julia Language

Example

# Load the logging module
using Logging

# Open a textfile for writing
io = open("log.txt", "w+")

# Create a simple logger
logger = SimpleLogger(io)

# Set the global logger to logger
global_logger(logger)

# Log a task-specific message
for in in 1:10
   @info i
end

# Write all buffered messages to the file
flush(io)
close(io)

By OP’s request I will delete the contents of this comment. A new version of the code will be posted by him.