LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping while loop after last element of 2d array is passed through

I posted something similar to this before, but what I got didn't work.  So this time I'll try to be more clear with what I am trying to do.  What I have done is combine two 1d arrays into a 2d array, and am using it to run an experiment.  I split the 2d array into a 1d array by column, and am trying to get the while loop that the array is in to stop after  the last element of the array is indexed.  I need to use a while loop because the array is constantly updating because the number of elements can be changed while the program is running.  What I am having trouble with is getting the while loop to stop after the last element has run, because the last element is subject to change.  Any ideas?

 

Thanks 

0 Kudos
Message 1 of 9
(3,834 Views)

Why is the array changing is size?  How do you know when the array has stopped changing?  Is data only being added or is the whole array changing?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(3,827 Views)

Sounds like you may want to use an actual state machine instead of a while loop.

Have you tried polling the array size and comparing it to the index terminal? (I think altenbach suggested that in your last thread.)

0 Kudos
Message 3 of 9
(3,826 Views)

We probably would need to see some example code. If the array is changing, how do you know what the last element is. What if the array grows again to size >2 during the last iteration.

 

Wherre is the data coming from? Where is it going?

0 Kudos
Message 4 of 9
(3,784 Views)

I can't get the code to you guys right now because of some admin issues, but how would I poll continously for the Array size.  Is there a VI that does that?

0 Kudos
Message 5 of 9
(3,765 Views)

As I told you in one of your other threads, your stopping logic is a mess and it looks like you do not have a good idea of data flow.

 

Also as I said before, give us a better understanding of what it is you are trying to do.  I think you will need to do some rearchitecting to do this properly.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 9
(3,750 Views)

I am trying to run a measurement using labview to control different instruments.  The program is suppossed tp work in that it runs a measurement for each current setpoint inputed, for 1 magnetic field setpoint.  So for example, if the magnetic field setpoint is 8000 gauss, and the two current setpoints are .00001 amp, and .0001 amp, it will run the meauserement twice for the 2 current setpoints for each magnetic field setpoint.  What I am trying to do is that sometimes, I might have to edit the magnetic field setpoints while the program is running.  I am having trouble with refreshing the magnetic field setpoints, which allows the user to input a new magnetic field setpoint while it is running.

0 Kudos
Message 8 of 9
(3,648 Views)

When you update a field in a while loop, such as the array for B Setpoints, it should update the next time the loop is run. This leads me to belive there is something inside your "B setpoint genorator.vi". Try to take a closer look at the subVI and see if the value is changing in there. 

Ben H.
Systems Engineer
National Instruments
0 Kudos
Message 9 of 9
(3,582 Views)