LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Numbers

Hallo,

I want to save a lot of measurements in one file each. The name should be "mess0001.txt", "mess0002.txt" etc.

For that I need to "fill up" the number of measurement with zeros. My way looks like this:

13 -> 31 -> 31000 -> 3100 -> 0013

(rotating, filling up, cutting of, rotating)

Does anybody of you know an easier and shorter way?

Arno
0 Kudos
Message 1 of 17
(4,043 Views)
It's easy with the Format Into String function. In your case, if you want a width of 4 and padded with zeroes, the format string would be "mess%04d.txt" (without the quotes). If you right click the function and select Edit Format String, you will get a dialog box that will help you create the format string. There is also a lot more information on format string options in the on-line help.
0 Kudos
Message 2 of 17
(4,043 Views)
I forgot something:

I am using LabVIEW 6.1. If you are using LabVIEW 7.0, please convert the VI, thanks.

Arno
0 Kudos
Message 3 of 17
(4,043 Views)
I did it that way:

array to string -> string lenght to case structure -> depending to the
case use Concatenate Strings with 0, 1, 2 or 3 zeros.

But maybe it is not esier then your way,

Niko


ASCologne wrote:

> Hallo,
>
> I want to save a lot of measurements in one file each. The name should
> be "mess0001.txt", "mess0002.txt" etc.
>
> For that I need to "fill up" the number of measurement with zeros. My
> way looks like this:
>
> 13 -> 31 -> 31000 -> 3100 -> 0013
>
> (rotating, filling up, cutting of, rotating)
>
> Does anybody of you know an easier and shorter way?
>
> Arno
0 Kudos
Message 4 of 17
(4,043 Views)
Here's basically the suggestion of Dennis as a LV6.1 example.
0 Kudos
Message 5 of 17
(4,043 Views)
Hi,
 
My problem is to create file names continuously, so that I can save different measurement files captured from my instrument.
 
The problem looks like this:
1. I am looping my instrument many times, say 500 times.
2. During each iteration, one measurement file is returned by instrument.
3. Now to save file I have to give some filename.
Also, the care should be taken so that there must not be any duplicate file names.(I am using Labviwe8.5)
 
As I am new to labview, So can anyone help me?
 
Thanks.


Message Edited by Piscesking on 04-07-2008 11:48 AM
0 Kudos
Message 6 of 17
(3,796 Views)
Hi Piscesking,
the example of altenbach shows exactly what you need. You said you are looping, so connect your loop iteration counter to the example from altenbach. With the created filename you can build a path and save your file. With this method duplicates are impossible, because with each iteration you get a new filename.
Mike
0 Kudos
Message 7 of 17
(3,789 Views)
Thanks, Let me try it out.
0 Kudos
Message 8 of 17
(3,784 Views)
Hi,
 
As asked earlier, I am using "for" loop to repeat the setup a number of times.
 
Now, as suggested,
Let N=20 (number of loops to be executed), then i=19
Now either I connect 'i' or 'N' with the example provided earlier, resultant is only one filename corresponding to respective number given.
 
or
 
I think I am not able to get the value of the counter. Can you help me out.
 
Thanks.
0 Kudos
Message 9 of 17
(3,752 Views)


Piscesking wrote:
Let N=20 (number of loops to be executed), then i=19
Now either I connect 'i' or 'N' with the example provided earlier, resultant is only one filename corresponding to respective number given.

i=19 is only true for the last iteration of the FOR loop. In the first iteration, i=0, second iteration i=1, etc. giving you a new value for each iteration that you can use to construct a unique file name with every iteration.
0 Kudos
Message 10 of 17
(3,748 Views)