LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shift register values

hi everybody,

                   I want to have the shift register values in an array, I have initialized the shift register with a constant zero and i want to take the buffered values of the shift register in the form of an array.

0 Kudos
Message 1 of 22
(3,709 Views)

Wire from the wire leading to the shift register to the right edge of the loop and enable auto-indexing.

 

(Shift registers don't keep all past values)

 

An alternative approach is to establish a blank array of the right dimension and use Replace Array Element with indexing off the iteration counter. This method may be more efficient, since there is no need to keep resizing the array.

0 Kudos
Message 2 of 22
(3,707 Views)

hi,

   Thank you for the reply. Can i update the shift register values inside the loop, because each time i need to take the last indexed value of the array and compare it with the previous value and finally i need to take the highest value in the array. This has to be done within the loop

0 Kudos
Message 3 of 22
(3,703 Views)

do you have any vi ?

0 Kudos
Message 4 of 22
(3,696 Views)

Yes   you can access the valus of the shift register inside the loop also...once all your comparison is done then you can get the final array at the output.

0 Kudos
Message 5 of 22
(3,695 Views)

Keeping track of the largest value is a separate excersise, so you can use either of the above methods.

 

To get the largest value, initalise a shift register with a number much smaller than you will encounter (such as -9999) and then check the shift register value against the latest value. If the latest value is greater put this into the shift register at the right, otherwise keep the current value. At the end of this the shift register output will contain the highest value. Alternatively, you can use the Max & Min function on the array output after the loop exits. 

0 Kudos
Message 6 of 22
(3,692 Views)

hi,

    By using the updated array values i need to compare between two values within the loop, is there any possibility to use those updated values in an array for the comparision purpose

 

0 Kudos
Message 7 of 22
(3,689 Views)

If you update the array inside the loop, you already have the old and the new value. Just compare the proper wires (from before and after array change).

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 22
(3,680 Views)

any idea why I have a extra "0" appended to the beginning of my array when I use a shift register?

It seems to be like this only when I use a 2d array, and works fine for a 1d array.

I initialize the SR at the while loop(blank constant), but I dont know where Im getting the extra zeros from!!

 

 

Thanks!

0 Kudos
Message 9 of 22
(3,589 Views)

@developer001 wrote:

any idea why I have a extra "0" appended to the beginning of my array when I use a shift register?

It seems to be like this only when I use a 2d array, and works fine for a 1d array.

I initialize the SR at the while loop(blank constant), but I dont know where Im getting the extra zeros from!!


This looks like a new question and you should probably have started a new thread.

 

There are millions of possible explanations! Since you don't show any code, all we can do is guess.

 

Maybe your shift regsiter is initialized with an array containing a single zero element. Make sure the array is truly empty. It could also be that you use a scalar followed by build array to initialize. This will also create an array with one element. In any case, you should blame your code. The shift register itself is innocent. 😉

 

Please show us some code! Should be easy to sort out the problem.

 

(also, the word is probably "prepended", not "appended")

0 Kudos
Message 10 of 22
(3,584 Views)