LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

adding element in the array

Solved!
Go to solution

  Hello,
i want to develop an Array in which new elements could be added and the previous entered element remain in it.
Kindly solve it.
Thx

0 Kudos
Message 1 of 16
(5,772 Views)

Hi Intelligent,

what have you already tried? Start with a loop and a shift register on it.

 

Mike

0 Kudos
Message 2 of 16
(5,765 Views)

Intelligent, Did you find Mikes reply useful?

 

Guru

Regards
Guru (CLA)
0 Kudos
Message 3 of 16
(5,744 Views)

From LabVIEW, go to Help - Find Examples and search on "arrays". Look at Feedback Node - Build Array.vi

Thats a pretty good example meeting your requirement.

0 Kudos
Message 4 of 16
(5,724 Views)

Thanks to all of you for replying.
I have tried all the given techniques, and they all generates array but my actual task is to record a value in an array such that the new value goes to the next index and the previous value remains there. And also it works in real time.

0 Kudos
Message 5 of 16
(5,680 Views)

Check out Build Array.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 16
(5,671 Views)

Hi intelligent,

 

so what is wrong with the mentioned examples? Or better: what is wrong with your VI?

You only say what you want, but don't show what you have done so far...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 16
(5,670 Views)

Intelligent wrote:


but my actual task is to record a value in an array such that the new value goes to the next index and the previous value remains there.


 

This is how most arrays work. If you have followed any of the samples this is how they will work. Can you post what you have done so far because if you are not achieving the above then i would imagine your doing something fundementally wrong.

 

Do you know how large your array will be. If you do it is a good idea to initialise an array and then use the replace element vi. If you are using the build array in a loop then this can lead to memory issues.

 

100th element.png

 

Here is an example that was written for someone else with a slightly different problem but illustrates the point. The array is first initialised with 100 elements. In the loop the initialised array is updated with the new elements. In this example the array is used as a circular buffer which is not what i beleive you are after.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 8 of 16
(5,658 Views)

My actual task is to record a certain value at certain condition. The value is recorded such that the latest value comes next to the previous.
With all the examples i successfully created the array but they last until the execution of the loop but what about when a new value comes and i have to place it in the array.
When using the Replace array function it requires an array with some values, the value corresponding to the index is replaced and when the index number is changed, the value now represents the new index value.
So i think that i may be able to make you ppl understand it.

0 Kudos
Message 9 of 16
(5,645 Views)

Hi Intelligent,

 

you did not answer our questions nor uploaded an example VI...

 

All you want can be done by BuildArray functions!

 

"i successfully created the array but they last until the execution of the loop"

 What do you mean by that??? Please attach your VI as asked before!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 16
(5,638 Views)