LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format into string 5 Digit counter starting from 00001 to 99999

Hi,

so i want to make file names with an attached count to the end of the file name starting from 00001 to 99999 so that it is limited. How do i do this with format into string

0 Kudos
Message 1 of 3
(2,092 Views)

%05d

However, you will need to check in advance that the number does not exceed 99999

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 3
(2,082 Views)

At least since LabVIEW 2016 (and possibly present as early as LabVIEW 2012) is the Create File with Incrementing Suffix VI -- it will automatically create files with names like "Test00001.txt" automatically for you if it finds the file "Test.txt".  If you don't want to keep track of the number (or want to automatically "add to the end of the list" without figuring out how many previous "Textnnnnn.txt" files are present, you can create an empty "Test.txt", use this VI to create the Incrementing Suffix File Refnum for you, and then delete "Test.txt" when you are done.  Here is an Example of this technique that creates 5 files based on Test.txt (note the 5-digit Format Specifier):

Incrementing FilenameIncrementing Filename

When I run this twice (with some time in between), I get the following 10 files:

Incrementing ResultsIncrementing Results

Bob Schor

 

0 Kudos
Message 3 of 3
(2,052 Views)