LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to disable an element of array?

Solved!
Go to solution

 

 

Hi,

 

Here i have written VI that will make an array of meaningfull data, for example: data pattern 23 16 16 24 

So whenever two consecutive 16 occurs, VI will delete one 16 from data pattern. But in my case wht problem i am facing is: 

Whenever it deletes 16 from data pattern, it will show 0 in place of 16 but  i need that cell fully disabled unless this 0 will count into mu data pattern. 

So i am trying to use disable property node for greying that particular cell or can any tell me why 0 is coming into array when it deletes 16 from it.

 Puneet

0 Kudos
Message 1 of 5
(6,464 Views)

Hi Puneet,

 

I can't load your vi as I only have LV7.1 available at the moment.

 

But:

From your description it seems you don't "delete" the element but you replace it with zero... Please make sure you really use "delete from array" here.

You can't disable a single element of an array - all elements share the same properties. The only difference between elements of an array is their value.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(6,462 Views)

 

 

Hi,  

Thanks for your reply. 

Please find attached screenshot.

 Puneet

0 Kudos
Message 3 of 5
(6,452 Views)

Hi Puneet,

 

from what I see in your screenshot the described behaviour is resulting from an unhealthy combination of using (hell a lot of) locals in combination with "use default if unwired" case structure output tunnels Smiley Wink

Remove locals (you already have a shift register, so use a wire instead!), use more descriptive names than "array", wire all output tunnels to avoid unwanted behaviour of your vi...

 

Why do you compare with an array (in your for loop) when you only need the result for the first element? Compare with scalar instead...

Why is "DLE Check" of type DBL? You only seem to use it as integer...

Why do you write to terminal "Array" and a local "Array" after the FOR loop? (Here is probably the root of the problem!) Only one of the write operations will be effective and you don't know which one...(possible explanation: the local array gets an array formed by autoindexing. So this array contains data for each iteration including an zero [because use of "default if unwired"] when you initially wanted to delete that very element!)

 

Aditional note:

Next time you attach a screenshot please use a picture format like PNG (as long as you don't use BMP)!

Message Edited by GerdW on 05-17-2009 11:03 AM
Message Edited by GerdW on 05-17-2009 11:05 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(6,438 Views)
Solution
Accepted by topic author Puneet_K

You really should start out with a few simple tutorial to familiarize yourself with basic array operations and FOR loops.

 

Your code makes no sense!

  • Why are you comparing single element arrays with constants, just to index out the single element results later. This can be done with 20% of the code.
  • You are randomly incrementing value in shift registers without ever using the contents. Why?

 

Do you want to reduce consecutive "16" to a single 16, or do you want to eliminate all consecutive duplicates?

 

Here's a quick draft that would delete consecutive 16s, keeping only one per group. Maybe it can give you some ideas. (LabVIEW 8.2.1)

Message 5 of 5
(6,428 Views)