From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

clear 2d array in while loop

Solved!
Go to solution

I have a 2D array being initialized on the outside of while loop running a state machine, how would one clear the 2d array within the while loop? I guess I'm not sure what to wire a blank 2D array constant too 😃

0 Kudos
Message 1 of 9
(4,234 Views)

Is the array being held in a shift register?

 

Share your code so we have a clue what you have.


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
(4,232 Views)

Yes it is...

0 Kudos
Message 3 of 9
(4,229 Views)
Solution
Accepted by topic author QRP

When you want to clear (whatever that boolean condition is), just wire a 2D array constant to your shift register.  See attached.

Message 4 of 9
(4,224 Views)

Then wire the empty array into the shift register.  You should pass the array through in the cases where the array isn't edited.


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 5 of 9
(4,222 Views)

That was too simple 😃 Thanks...

0 Kudos
Message 6 of 9
(4,214 Views)

Could some look at this sample VI I though together regarding clearing the 2D array. All works great until I clear the 2D array, then it must reset my original array settings by wiring the blank constant since it just overwrites the first line and does not append to the array after the clear. I need to have an array that only allows 20 lines worth, clear and reset back to allowing 20 lines of data. Thanks for your help.

0 Kudos
Message 7 of 9
(4,199 Views)

Never mind I figured it out 😃 I just need to wire the initailize array again instead of the constant 😃

0 Kudos
Message 8 of 9
(4,194 Views)

@QRP wrote:

Could some look at this sample VI I though together regarding clearing the 2D array. All works great until I clear the 2D array, then it must reset my original array settings by wiring the blank constant since it just overwrites the first line and does not append to the array after the clear. I need to have an array that only allows 20 lines worth, clear and reset back to allowing 20 lines of data. Thanks for your help.


For the clear operation, you should wire the original array from outside the loop instead of an emtpy array.

 

If the size is fixed at 20 entries, you should operate on an array with fixed size, initized with all empty strings. Now simply replace the oldest data on top and shift the other entries down, keeping the size constant.

0 Kudos
Message 9 of 9
(4,190 Views)