From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

select values from an array

I am a beginner labview user,

 

I am making a case structure that currently has a random number (0-1) numeric wired to the selector terminal.  The case structure is executing true/false events based on that. This is working fine.  My problem is that I want the 0s and 1s to be predetermined. For example, I would want these numbers to be inputted one by one: 1 1 1 1 1 1 0 0 1 1 1 1 1 1. I do not want to manually click/input the numbers using numeric controls.

 

I used an array to do this but it is giving me an error when i am trying to wire the array to the selector terminal.

 

Please let me know if you need further clarification.

0 Kudos
Message 1 of 6
(2,753 Views)

Try enclosing the case structure inside a for loop. Wire the array through the border of the loop.  The tunnel will automtically set to auto-indexing.

 

Also it is generally not a good idea to wire floating point numbers to the selector terminal. Which case would you expect when the value is 3.5? Switch to an integer data type.

 

Lynn

0 Kudos
Message 2 of 6
(2,750 Views)

I dont quite understand.  This is a simplified version of what i am trying to do.  But instead of random 0 and 1, I would like chosen 0s and 1s. For example, the sequence 1 1 1 1 1 1 0 0 1 1 1 1 1 1

0 Kudos
Message 3 of 6
(2,745 Views)

Is there a better method to do this other than an array?  Remember, i do not want to input these numbers.  They need to be hardcoded.

0 Kudos
Message 4 of 6
(2,742 Views)

Array is a good way. If the arrays are large or could change rarely, storing the data in a file which could be read in and then processed might be an alternative.

 

You could also store the data as booleans directly.

 

Here is an example to give you a few ideas.

 

Lynn

0 Kudos
Message 5 of 6
(2,737 Views)

Thank you!! That helped alot.

0 Kudos
Message 6 of 6
(2,706 Views)