From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Having problem with ARRAY organization

Solved!
Go to solution

Dear friends,

As a new LabView user, I am having trouble with a very basic array related problem. 

I am working on signal data processing especially with temperature data. I sensor will create thousands of data, however I need to store data into a 1D array with 5 index and everytime new data will come in it will replace the first data.

Example: 

1st temprature value, 10 degree comes in it will be stored in index 0,

2nd temprature value, 10.5 degree comes in it will be stored in index 0, & 10 degree will move to index 1. 

I want this process for upto 5 indexes

And when 6th temperature value comes in it will be in index 0; ..., 2nd temperature data will be in index 5; however, 1st temperature will be out of the array. 

 

Please help me and your help is much appreciated.

Thank you so much in advance

0 Kudos
Message 1 of 6
(2,072 Views)

You want the 'Build Array' function.

Build Array Example.png

 

0 Kudos
Message 2 of 6
(2,052 Views)
Solution
Accepted by topic author Forhad

Well, you need to rotate the array too, else you run out of elements once it gets larger than the buffer.

 

You can also use the data queue ptbypt.

 

Here are thew two possibilities:

 

lastFiveelements.png

Message 3 of 6
(2,039 Views)

Hello MrJackHamilton,

I am so thankful to you for your quick response. 

I need to limit the array size upto 4 indexes and put the new data into index 0, and move out the element of index 4 out of the array when a new data comes in, and this will continue for thousands of data. 

I have attached a file. This might help

 

Thank you so much for your time, I really appreciate your help.

Forhad 

University of Windsor

Ontario, Canada

0 Kudos
Message 4 of 6
(2,032 Views)
Solution
Accepted by topic author Forhad

OK, here's code adjusted according to your latest specifications.

 

 

Message 5 of 6
(2,000 Views)

Hello Altenbach,

I can't thank you enough for your help. I really appreciate your time. 

I am working on a project at University of Windsor, part of the project relates to LabView. As a new LabView user, I am struggling with basics. Please keep in touch.

 

Thank you and have a wonderful day.

0 Kudos
Message 6 of 6
(1,951 Views)