12-02-2015 11:01 PM
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.
12-03-2015 12:51 AM
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?
12-03-2015 11:54 PM
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
12-04-2015 02:47 AM - edited 12-04-2015 02:48 AM
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?
12-04-2015 05:05 AM
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.
12-04-2015 06:45 AM
12-15-2015 02:46 AM
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.
12-15-2015 02:50 AM
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)!
12-15-2015 04:24 AM
In the search box on the functions palette, type 'Decimate' because that's what it sounds like you want to do.
12-16-2015 11:01 PM
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??