I am a rather new user and I am running a simulation experiment. I would like to learn how to write output data to file. I am considering buying the the Big Book of Simulation Modeling which is based on AnyLogic 6. Are there major differences between AnyLogic 6 and 8 in reading/writing data to file? Unfortunately, they haven't released that chapter for the current version of the book that is online. Are there other resources about writing output data to files? Thanks!
Asked
Active
Viewed 517 times
0
-
there's a full section on how to write data to excel in the help documentation that is easy to follow... unfortunately when you say "write to a file" a file can be anything... you need to be more specific... – Felipe Aug 08 '21 at 23:05
-
Thanks! I will check it out. I need the data written to a CSV file so I can analyze them in R. – JayT Aug 09 '21 at 03:31
1 Answers
1
Assuming your question is about writing a csv file and not to excel as per your comments, if you want to make use of the standard AnyLogic objects you can easily follow the instructions from the help here
https://anylogic.help/anylogic/connectivity/text-file.html
If you prefer to be in full control of the writing to the CSV file you can also easily use some standard Java functionalities and create a function like this.
The String input can then be any piece of string, with what ever separators you want, comma ,
, pipe |
, tab "\t"
etc, and you simply need to add in line breaks "\n"
in your string to write new lines in your output.

Jaco-Ben Vosloo
- 3,770
- 2
- 16
- 33
-
@JayT Remember to accept my answer if you found it helpful, and upvote if you think it deserving ;-) – Jaco-Ben Vosloo Dec 21 '21 at 08:56