LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating a array with a while loop

Solved!
Go to solution

hi everyone

 

my problem is to get a two input data and form a array, them export to a spreadsheet file

but i dont know the amounth of inputs data, that's why im using a while loop, then i use a "NEXT" button to put the input data into the array

the problem is that the array always have only 1 element, not the entire data that i need

 

heres a simple block code of the case 

 

imagem.PNG 

 

i hope someone could help me

thxs 

0 Kudos
Message 1 of 6
(3,147 Views)

You  need to build up the data in the outer loop, then write it to file once the outer loop stops execution. Like this:

 

 

The code doesn't work, but the conceptual statment makes sense.

 

Message Edited by sgregor249 on 12-21-2009 02:30 PM
0 Kudos
Message 2 of 6
(3,134 Views)
Doing it at the end is one option. Another option is to fix the code so that the file is not overwritten with each iteration. Turn on Context Help and look at the 'append to file?' input.
0 Kudos
Message 3 of 6
(3,131 Views)
Your inner while loop is running super fast and continually appending the same data onto the array until you hit the next button because you have autoindexing turned on.  I'm sure you don't want a million +element array of the iteration count along with a million + values of whatever is typed into the control.
Message 4 of 6
(3,123 Views)
Solution
Accepted by Peituh

Thank you everyone, yours answers really helps me to figure it out how to solve my problem

here is a picture of the block diagram, it fits better to my case, because both input are variable, instead of a counter 

imagem.PNG 

 

  

0 Kudos
Message 5 of 6
(3,097 Views)
That's not right at all. Since you don't have auto-indexing on, the only thing you will record is the very last iteration of the inner while loop. That may not make a difference with this VI that is apparently simulating some sort of acquisition with those controls but if you are doing real acquisition, it would be throwing away large amounts of data.
0 Kudos
Message 6 of 6
(3,091 Views)