LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

building array with a case

Hello,
I'm new to Labview and would really like to know how labview implements something like this:
x(1)=10
x(2)=11
x(3)=12
j=1
for i=1 to 3
if x(i)<>11 % if x(i) does not equal 11
y(j)=x(i)
j=j+1
end if
end for

to get an array y(1)=10 y(2)=12

thanks in advance,
Ben
0 Kudos
Message 1 of 5
(2,779 Views)
FOR loop with Shift Register (SR)
CASE structure inside loop
BUILD ARRAY function inside TRUE case

SR initialized with empty array of I32 (or doubles, if you prefer)

X[ ] array comes thru the left wall of the FOR loop, automatically indexing it.

Compare X to 11 with a NOT EQUAL function.

In the TRUE case, use BUILD ARRAY to append X to the array in the shift register(Y[ ]). Pass the appended array out to the SR right terminal.

In the FALSE case, pass the SR thru unchanged.

Use the array out of the right SR terminal to display or whatever.

It took me longer to write these words, than it would have to do it.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 5
(2,779 Views)
Hi,
As CoastalMaineBird indicated this is done way easier than explained so I decided to build a simple one for you.
Please look into the example programs that ship with LabVIEW (Help >> Find Examples)
Feroz P
National Instruments
Message 3 of 5
(2,779 Views)
Thanks CoastalMaineBird and Feroz for your time. I understand now. It was difficult for me to find an example with the shift registers.
regards,
Ben
PS Feroz, my version 6.1 doesn't seem to open your version 7 program.
0 Kudos
Message 4 of 5
(2,779 Views)
Hi Ben,
Here's the VI for LabVIEW 6.1
Feroz P
National Instruments
0 Kudos
Message 5 of 5
(2,779 Views)