print_csv¶
Syntax¶
Parameters¶
filename- The file to write to.
var_str- A variable to print.
Description¶
This action will print out variables to a specified file in the order they are listed in the arguments.
Important
open_csv must be called prior to calling print_csv.
Examples¶
agents.txt:
main.fred:
simulation {
locations = none
default_model = none
start_date = 2020-Jan-01
end_date = 2020-Jan-01
}
variables {
shared list new_agents_list
}
condition PrintCSV {
start_state = Agent_Start
meta_start_state = Meta_Start
state Meta_Start {
new_agents_list = read_agent_file(agents.txt)
read_agent_file(agents.txt)
open_csv(out.txt,"id","sex")
wait()
next()
}
state Agent_Start {
print_csv(out.txt,id,sex)
wait()
next()
}
}
The above FRED code prints the following file:
out.txt: