LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A quesiton about case structure

Hello

I just try to write a simple program.

e.g. I have a for loop (N = 10), if i > 5, I want to output the value into array ([6, 7, 8, 9] is what I want). But in labview I have to wire a value in the "false" case, so my output become [0, 0, 0, 0, 0, 0, 6, 7, 8, 9].

How can I solve this problem?

Many thanks,
Stephen
0 Kudos
Message 1 of 5
(2,855 Views)

Hi Stephen,

You need to use a shift register for the array.  In the first half of the iterations, don't add anything to your array.  But once the iteration count passes your threshold, start building the iterations into the array.  I have attached a VI to this e-mail.  Notice also that I've included the logic for switching out cases directly in the case structure with the "..4" and "5.." cases.

You should check out the LabVIEW Help on shift registers...they're a little hard to understand when you first start using LabVIEW, but they are an indispensable feature when dealing with loops.  While you're at it, check out the LabVIEW Help on Case Structures to learn about other neat things like the "..4" and "5.." notation.

-D

Message 2 of 5
(2,844 Views)
Shift Registers - See Example
Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 3 of 5
(2,837 Views)
Try This

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 4 of 5
(2,833 Views)
Thanks for everyone's reply.

It is very helpful, you guys are the best, thanks.
0 Kudos
Message 5 of 5
(2,825 Views)