LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple arrays

Solved!
Go to solution

hi,

 

I am having difficulties with this very simple array (following). I want to store data through a while loop which is why I tried with a very simple example. And it doesn't work. The data is erased every loop, and i must set the dimension of the array (100 for this example) to get something or my array stays at 0... but I won't know it in my VI.

 

Thanks for the help!

 

simple array2.JPG

0 Kudos
Message 1 of 7
(3,039 Views)

Use a shift register which will store the data from the previous iteration(s) you then append the new data to the array for each time the while loop executes (Right click on the edge of the while loop and you will find the Add Shift Register option) - Mike

Edit Once to resolve typo!

Message Edited by mike alder on 06-29-2009 09:56 AM
0 Kudos
Message 2 of 7
(3,035 Views)

Hi christoph...,

you need a shiftrehister on your loop. Right click the loop and select "add shiftregister".

This is a basic question, i recommend to see the free online courses.

 

Mike

Message 3 of 7
(3,034 Views)

hi,

 

Thanks for your answers! Sorry i forgot about that...

 

It is working but only if i set the dimension of the array...any clue about how to make this VI work without setting it ?

0 Kudos
Message 4 of 7
(3,026 Views)

Hi christoph...,

you can also initialize the shiftregister with an array constant and use the build array function inside the loop.

 

Mike

0 Kudos
Message 5 of 7
(3,021 Views)
Solution
Accepted by christophe69000

Since you are using Replace array element the element needs to exist prior to rewriting the element.

Here are two examples in on shot:

The upper one uses autoindexing, this has the disadvantage that you don't have the data until the loop is finished.

 

The lower one uses append array element and feedback notes.

 

Ton

 

 

Message Edited by TonP on 06-29-2009 11:24 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 6 of 7
(3,017 Views)

hi,

 

Thanks for the help! Sorry if it is a basic question...

0 Kudos
Message 7 of 7
(3,009 Views)