LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create continous sequence of numbers

Hello

 

I need to create numbers starting from 1 to n. I need these numbers to add as ending in the name of files that are being saved. For example File_1, File_2........etc.

 

I tried to create a for loop (n= 100) and wired the "i" outside. Only i need is these i values ( 0,1,2,3,.....100)

 

How is i possible? See attachment ffor what i have done.

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 1 of 11
(3,466 Views)

Hi Nghtcrwlr,

this works.

 

Mike

Message 2 of 11
(3,463 Views)

Hi Nghtcrwlr,

 

you can't connect an array to FormatIntoString... 

It works like this:

Numbers_file name_BD.png

 

I suggest a format of %03d instead of %d.

And btw. "(0,1,2,3,...100)" are 101 values Smiley Wink

 

Mike beats me - I had to start LabView first...

Message Edited by GerdW on 07-24-2009 02:05 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(3,459 Views)
***message deleted*****
Message Edited by muks on 07-24-2009 07:22 AM
0 Kudos
Message 4 of 11
(3,445 Views)

Hi all

 

Thanks for your responses. I made it in another way. I created a while loop and inserted my VI inside it. Then wired the "i" as input number to the name ending.(i.e used  concatenate function to join the string "Filename" & "i"). So as long as the VI runs , those values are automatically created. When you stop the VI , it also stops.

 

Anyways thanks for all your ideas. Sometime later, i might need them:P

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 5 of 11
(3,416 Views)
Again Mike and Gerd, how is it possible to access each element  of the array at a time? do i just need to do the autoindexing at the output end?
Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 6 of 11
(3,413 Views)

Nghtcrwlr wrote:
Again Mike and Gerd, how is it possible to access each element  of the array at a time? do i just need to do the autoindexing at the output end?

 

Once the names are in an array, you can use the 'Index Array' function to index a certain cell.

Cory K
0 Kudos
Message 7 of 11
(3,400 Views)

Nghtcrwlr wrote:
Again Mike and Gerd, how is it possible to access each element  of the array at a time? do i just need to do the autoindexing at the output end?

 

It's meaningless to first build up an array with a loop and then go through all the elements using a second loop Smiley Surprised

Can you give us a complete picture of the problem instead of some bits & bytes now and then ?

That way we can suggest the best way to go Smiley Wink

0 Kudos
Message 8 of 11
(3,397 Views)
Ok Alain... here s the problem. I have a VI that writes some values to Excel and saves. Each time the VI is run it saves an Excel file. I need the Excel file naming like " File_1, File_2...etc.Those numbers 1, 2 should come at the ending in name. That was what i needed. But as i mentioned, i already got the solution in another way.
Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 9 of 11
(3,381 Views)

Nghtcrwlr wrote:
Ok Alain... here s the problem. I have a VI that writes some values to Excel and saves. Each time the VI is run it saves an Excel file. I need the Excel file naming like " File_1, File_2...etc.Those numbers 1, 2 should come at the ending in name. That was what i needed. But as i mentioned, i already got the solution in another way.

 

In that case, the following vi is what you need.  You send in the basic file name, like "File_", and it returns the next numbered file name, like "File_003".  The next time you call it, it will return "File_004", and so on.  The first time you ever call it, send in a True on the Start Over? boolean input.  After than send in a False.  The vi contains a LV2 Style Functional Global.  The shift register is uninitialized.  It remembers what is in the shift register from the time it was called before.  The first time you call it, you must make Start Over as True so that it can initialize the shift register with 1.  Then the file name will be FIle_001.  Next time you call it, Start Over is False, and the shift register gets incremented, so the 1 becomes a 2, and the output is File_002.

I think this is the best way to handle your problem.  It is both quick and easy.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 11
(3,355 Views)