LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shift register doesn't change the array values

Hi all,

 

I think this should work, but the array that is returned at the end of the for loop is the same as the array that is passed in at the beginning of the for loop.

 

I start with a cluster array.  Some of the data items might contain a 'number' value of '0'.  While this is the data that was returned, it is not valid data for processing.

So, I want to look through the array, check the value of number in each cluster, and if it is zero, replace the 'number' in this cluster, with the 'number' value from the cluster in the previous array item.

 

I was getting strange results after processing, so I modified the routine to write out the incoming data (before the for loop) to disk, and the resultant data (after the for loop) to disk, they are the same.

I don't know why the 'number' values are remaining at zero.

 

I put in a break point, and added probes, and the processing seems to be what I expect, if a zero is encountered, the previous array item is read, and it's 'number' is passed to the bundle function.

But it apparently isn't saved.

 

I called tech support, and they suggested I use the 'In Place Element' structure.  Either using its functionality to unbundle/bundle, or array element replace.

I tried that, and neither one solved the problem.

 

The array of clusters at the end of the loop, is the same as the array of clusters at the beginning.

 

I have simplified the code to demonstrate, and that is attached.

 

Thanks for any input.

Jeff

 

0 Kudos
Message 1 of 4
(2,561 Views)

@DMJeff wrote:

I have simplified the code to demonstrate, and that is attached. 


Maybe you simplified too much!

 

Well, you don't have any indicator at the output of the shift register, so how exactly are you telling if anything has changed? If I place an indicator there and put some sample data into the input cluster, things seem to work just fine.

Message 2 of 4
(2,548 Views)

Hi Altenbach,

 

Thanks for the reply.  I went back to the original and took another look.

 

Apparently I was working too fast, and didn't notice that there was an input tunnel at the same location as the input shift register (and that got cleaned up in the simplificaiton).  The active wire was using the tunnel, and not the shift register.  So, there was an unused 'input' shift register.  Every time the loop iterated the array was sent to the output shift register, but at the start of the loop the original tunnel was providing the original array.  I don't know why there wasn't an error for the unwired shift register, but that was the problem.

 

Thanks for suggesting that I take another look.

 

Jeff

0 Kudos
Message 3 of 4
(2,510 Views)

There's no error for unwired shift registers. It's actually a feature you use if you want the VI to remember data in between calls, if you wire the shift register from the outside it'll reset on each call.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 4
(2,496 Views)