From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Shifter Register Help with Case structure

Hello,

 

I am quite new to LabVIEW and am having an issue with a shift register. I have a case structure within a for loop. I am sending a 1D array into the for loop, and if my condition is true, I would simply like to let the value leave. For false I am trying to simply do nothing, allowing the for loop to filter out the elements that don't meet my criteria.I tried using this shift register, but to no avail.

 

Attached is my code, the area of interest is at the bottom of the block diagram where it leads into the 1D array "index (closest < D)"

 

Any advise would be appreciated.

0 Kudos
Message 1 of 8
(3,311 Views)

You only have one shift register shown in your VI, and that is in the third of your four For Loops.  You are either incrementing a value or not incrementing a value.

 

If you are talking about your fourth For Loop, you don't have a shift register there at all.  Your code is actually broken because you have an unwired tunnel.  If you want to selectively build an array, then you need to add a shift register for the array, and either build a new element onto the end of the array in one case, or pass it through untouched in the other case.

0 Kudos
Message 2 of 8
(3,309 Views)

Sorry, Uploaded the wrong version. I've been testing it with entering in N= 4, and D = 50. I am unsure how to wire the false case to do nothing, so far I just have wire it through in the false case which is not correct. Thank you.

0 Kudos
Message 3 of 8
(3,304 Views)

Can you save your VI as LV2010 and repost (File>>Save For Previous Version)?  Thanks.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 4 of 8
(3,278 Views)

Hi Scirocco90, 

 

I'm not quite sure if I understand you very well. Do you want to feed in a pre-existing array and then check the values of the array and delete elements as needed? Or do you want to build an array based on input numbers, and decide whether these inputs are valid or not before putting them in the array?

 

I have attached an example program which builds on array based on whether the boolean button on the front panel is turned on or off. If the button is true, the case structure is entered and the build array function is reached, which adds the value in "Number to Insert" to the array. However, if the button is off, the array is not added to. It may be easier for you to use while loops with shift registers instead of for loops as well. I hope this helps! 

 

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments
0 Kudos
Message 5 of 8
(3,238 Views)

@julianne K wrote:

Hi Scirocco90, 

 

I'm not quite sure if I understand you very well. Do you want to feed in a pre-existing array and then check the values of the array and delete elements as needed? Or do you want to build an array based on input numbers, and decide whether these inputs are valid or not before putting them in the array?

 

I have attached an example program which builds on array based on whether the boolean button on the front panel is turned on or off. If the button is true, the case structure is entered and the build array function is reached, which adds the value in "Number to Insert" to the array. However, if the button is off, the array is not added to. It may be easier for you to use while loops with shift registers instead of for loops as well. I hope this helps! 

 


One suggestion I have, and this should be standard practice for all app engineers who work with NI, when you post, down convert your code to something like 8.2 so more folks can view your suggestions.  We all can benefit this way.  Thanks.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 6 of 8
(3,213 Views)

code snippets are also good to show many people the solution..

0 Kudos
Message 7 of 8
(3,200 Views)

Hi MoReese,

 

Thanks for the suggestion. I have attached the code saved in version 8.2 and also a screenshot of the code snippet. 

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments
Download All
0 Kudos
Message 8 of 8
(3,176 Views)