Page 1 of 1

how to save data to files automatically in a for loop

Posted: Wed Jul 21, 2010 7:13 am
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

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

Posted: Wed Jul 21, 2010 11:58 am
by ted
Use sprint to build the file name string. See this discussion thread:
Indexed file
viewtopic.php?f=8&t=1046