"How to Loop
dragonedison
New Altair Community Member
Dear everyone,
I use "Loop Attribute Subsets" to implement the classification process, and I would like the classification result of each case in the dataset be stored, so I use the "Write CSV File" opererator to save it. However, I discovered that this operator doesn't implement an "attach" writing like the "Write as Text" operator, which means that each time this operator deletes the content of the file and write new results to it. I would like to know if there is any way to let the "Write CSV File" operator create a new file for writing results each time while keeping the old results.
I know that there is a "Loop Files" operator, but I don't know how to use it to implement this task.
Thanks.
Gary
I use "Loop Attribute Subsets" to implement the classification process, and I would like the classification result of each case in the dataset be stored, so I use the "Write CSV File" opererator to save it. However, I discovered that this operator doesn't implement an "attach" writing like the "Write as Text" operator, which means that each time this operator deletes the content of the file and write new results to it. I would like to know if there is any way to let the "Write CSV File" operator create a new file for writing results each time while keeping the old results.
I know that there is a "Loop Files" operator, but I don't know how to use it to implement this task.
Thanks.
Gary
Tagged:
0
Answers
-
Hi Gary,
how about appending a counting value to the output filenames? You could initialize a counter just before the Loop operator is called (Generate Macro) and increment it inside the loop. If you append this macro to the filename for the CSV files you will get one file per loop run / case.
This should easily solve the problem. Or did you expect something different (for example all contents in a single file)?
Regards,
Matthias
PS. Loop files just works for existing files, it doesn't generate new ones.0 -
Dear Matthias,
Thanks for your advice! I will try.
Regards,
Gary0