LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array

Hi all,

 

I have an array which contains N number of elements. These elements are acquired through serial communication.I want to divide the array into 100 elements. I used split 1D array function but it will give only first and second array. the data acquisition is through loop. So please help me how can I divide the array so that every loop iteration it stores only 100 elements and the same array has to be updated with next 100 elements for next loop iteration.

0 Kudos
Message 1 of 11
(3,670 Views)

Sorry, your description is not very clear. It would help if you could attach a simplified version of your VI.

 

Do you know N from the beginning? Is this a 1D array?

How many elements are read with each seriel comunication?

Do you want to only keep only the latest 100 elements or do you e.g. want to build up a 2D array where each row has 100 elements?

Yes, split array gives you two parts. What more do you want from it?

(Don't use the word "divide", because it can be confused with the division operation!)

 

Can you explain your problem graphically instead?

0 Kudos
Message 2 of 11
(3,645 Views)

N is not defined. It should be an 1D array. The array has to store the serial communication data but the size of the array should be for 100 elements.Say for example I perform serial communication for 1s, during that time I may get 400 numbers of data but the array has to store 100 for first then store next 100 then next. it has to be updating kind of. 

 

I think I stated my problem correctly now

0 Kudos
Message 3 of 11
(3,583 Views)

Hi reva,

 

why do you need to store just 100 elements when you receive 400 of them?

For how long do you need to store 100 elements before you store the next 100 elements?

 

No, your problem still isn't "stated correctly" (at least for me)!

As Christian asked for: Can you share any example graphics? Or even some VI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(3,568 Views)

It is because these 100 points will be plotted as graph. and these 100 elements are stored for a duration of 1s.

It is like I want to update a graph with 100 elements every 1s even though the serial communication data points are 400 in numbers.

0 Kudos
Message 5 of 11
(3,555 Views)

Hi reva,

 

the remaining 300 samples received from your device will be thrown away?

 

If so: plot the first 100 samples to your graph. Update the graph once a second…

Best regards,
GerdW


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

No it should not be thrown away it  has to be stored in an array. after the plot of 1st 100 points the program has to take next 100 then plot.

0 Kudos
Message 7 of 11
(3,434 Views)

Hi reva,

 

use a shift register to collect your array data. With each "read access" you remove the oldest 100 samples from your array…

 

You could even put that "add new data"/"read 100 samples" thing into a FGV (Functional Global Variable aka AE/Action Engine)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(3,428 Views)

In the search box on the functions palette, type 'Decimate' because that's what it sounds like you want to do.

0 Kudos
Message 9 of 11
(3,417 Views)

So far this is the VI  I have been working. this VI reads 250 samples and plots as graph and stops. but I want the loop to be running continously and for every iteration the array should be updated with latest 250 elements.

 

Can we set the loop duration to 1s?? 

0 Kudos
Message 10 of 11
(3,370 Views)