LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Random number array and output to string

Solved!
Go to solution

I'm trying to generate random numbers, convert them to strings, and then print them to a string with commas separating them. I can build this manually (work in progress), but I'm trying to be more efficient and use a loop/array arrangement. Any advice?

 

Capture.JPG

0 Kudos
Message 1 of 7
(4,182 Views)

Definitely use a loop.

 

You can output the strings as an array and use Array to Spreadsheet string with a comma as a delimiter.

For writing to individual controls, output, the numbers as an array and use a single Index Array outside of the loop expanded to give you multiple outputs and wire each one up to the individual indicators.

Message 2 of 7
(4,175 Views)
Solution
Accepted by Superdude_123

Change the format string if you want a different number of decimal places.

 

Example_VI_BD.png

aputman
0 Kudos
Message 3 of 7
(4,173 Views)

Would you mind drawing up an example?

 

I'm thinking that it would be practice to shift the values in to the array by using the loop iteration to index the value. The challenge that I am having is figuring out how to put it together.

 

0 Kudos
Message 4 of 7
(4,168 Views)

aputman:  Why are you using 15 and not 16? Does the loop start at 0?

0 Kudos
Message 5 of 7
(4,165 Views)

@Superdude_123 wrote:

aputman:  Why are you using 15 and not 16? Does the loop start at 0?


I picked a random number.  If you want 16 numbers, the loop needs to run 16 times.  The "I" (iteration) terminal will start at 0 but that doesn't matter for what you are doing.

aputman
Message 6 of 7
(4,160 Views)

@Superdude_123 wrote:

Would you mind drawing up an example?

 

I'm thinking that it would be practice to shift the values in to the array by using the loop iteration to index the value. The challenge that I am having is figuring out how to put it together.

 



Aputnam drew what I was thinking.  Actually a better version than what I was visualizing.

0 Kudos
Message 7 of 7
(4,155 Views)