03-02-2020 10:56 AM
How do you create a unique file name when using Write Waveforms to a file.vi that is in a loop ? I have that VI in a for next loop and want my file name to be unique to each iteration of the loop. For example, the 1st iteration of the file might be c:\testing\filename1.dat then next c:\testing\filename2.dat ..then c:\testing\filename3.dat ..etc.. How do you concatenate the file name w the loop iteration to come up w a filename that is unique w each loop?
thxs
Solved! Go to Solution.
03-02-2020 10:59 AM
Use Format Into String to combine the base filename with the iteration number to create a new file name. So your format string could be filename%d.dat
Then use Build Path to combine the file name with your base path for the directory structure.
03-02-2020 11:16 AM
Perfect..thank-you.
03-02-2020 01:49 PM
A very tiny addition:
You might want to consider a number format specifier like "%03d". This would pad with 0's and make all numbers 3 digits wide, which is handy when you want to sort by filename when navigating into the folder.
-Kevin P
03-02-2020 01:59 PM
@Kevin_Price wrote:
A very tiny addition:
You might want to consider a number format specifier like "%03d". This would pad with 0's and make all numbers 3 digits wide, which is handy when you want to sort by filename when navigating into the folder.
-Kevin P
Or maybe just use the built-in function that AQ wrote, located in the Advanced File Function Palette:
mcduff