2

I am running BehaviorSpace in NetLogo using the NW Extension to run several networks experiments and I need to save the network matrices into files with different names.

Right now, I have the following:

to create-network   
 code to create network ...  
 nw:set-context-turtles links   
 nw:save-matrix "matrix.txt" 
end

But this means that every time BehaviorSpace runs through "matrix.txt" is overwritten. Basically I want to output matrix1.txt to matrix100.txt if I run 100 simulations, for example.

Seth Tisue
  • 29,985
  • 11
  • 82
  • 149
Gigi
  • 113
  • 1
  • 4

1 Answers1

3

You can create unique matrix names with word and behaviorspace-run-number. For example, let mname (word "matrix" behaviorspace-run-number ".txt").

Alan
  • 9,410
  • 15
  • 20
  • May I know where in the code above I can add that line? I tried the following, but did not work: `to create-network code to create network ... let mname (word "matrix" behaviorspace-run-number ".txt") nw:set-context-turtles links nw:save-matrix mname end` – Gigi Aug 06 '14 at 14:06
  • It should work. What do you mean by "did not work"? Did NetLogo give you an error? If so, what is it? If not, the files probably exist but you someplace different than you're looking. (Try using a fully qualified path name.) – Alan Aug 06 '14 at 14:45
  • No error... First time around, the output did not show. I just re-ran and the output was there! Thank you! – Gigi Aug 06 '14 at 14:55