how to save data to files automatically in a for loop

The basics of how to develop, test, and use models.
Post Reply
zhg2601
Posts: 6
Joined: Fri Dec 12, 2008 11:52 pm

how to save data to files automatically in a for loop

Post by zhg2601 »

for example, I have a parameter to scan, in a for loop.
for i=1; i<10; i=i+1
{
open a new file
write to this file
close it
}
how to name the new files automatically, such as data_1.dat data_2.dat data_3.dat
ted
Site Admin
Posts: 6303
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: how to save data to files automatically in a for loop

Post by ted »

Use sprint to build the file name string. See this discussion thread:
Indexed file
viewtopic.php?f=8&t=1046
Post Reply