LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to buffer values in in loop to generate an array of values

Hello Everyone

i have a problem. I am calcuting phase of a sinal in a timed loop. This phase is wrapped and i want to unwrap it. But in labview the phase unwrap vi can be operated only on 1D Array. But the value i am getting in the loop each time is a single value. So is there somehow i can make an array of some of these phase values such that in each new iteration the the present phase replaces one of the element at the edge of the previous array. It would be something what a waveform chart does where each new element replaces the element at the edge and rest of the elements are shifted by one position.

Regards
Chauhan
0 Kudos
Message 1 of 8
(3,774 Views)
It sounds like instead of making an array of these values you could use a queue to create a FiFo buffer of the values.  I might be better able to help if you could attach your vi.

Good Luck!
0 Kudos
Message 2 of 8
(3,768 Views)
you could use "replace array subset" in a for loop. connect the loop iteration to the index input. each time through, a value at index is replaced...
0 Kudos
Message 3 of 8
(3,764 Views)
Look under the 'Point By Point' palette under Signal Conditioning There is a version of Unwrap Phase that you might be able to use...

http://zone.ni.com/reference/en-XX/help/371361B-01/ptbypt/unwrap_phase_ptbypt/


0 Kudos
Message 4 of 8
(3,746 Views)
Hi

The way i am trying to create a buffer is shown in the VI attached. I am calculating the phase and i want to make a buffer of around 1000 elements such that new element is added at the end of the queue and when the queue is totally buffered the first element is removed to acomodate the new element. Actually i don't know what should be the process of generating the queue. This is the program i want to use except the phase calcultion part which here i am using as a control. Can you please help in this.

Regards
Chauhan
0 Kudos
Message 5 of 8
(3,727 Views)
From looking at your vi, you will need to place the Obtain Queue.vi outside of your while loop and also wire the Get Queue Status.vi Return Elements as True.  See the image below.  As far as the workings of the queue this should add data to the buffer until it reaches 990 and at that point it will add to the bottom of the buffer while removing from the top.  Let me know if the queue does not accomplish what you are trying to do.

Good Luck









Message Edited by jmcbee on 04-09-2008 12:55 PM
0 Kudos
Message 6 of 8
(3,717 Views)
As a note, my check for array size of greater than 9 will not work, for it to work it should be greater than 8.  Your original values of 1000 and 990 will be fine.
0 Kudos
Message 7 of 8
(3,708 Views)
Hi

Thanks for your help. It indeed solved my problem.

Best Regards
Chauhan
0 Kudos
Message 8 of 8
(3,695 Views)