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.
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.
10-03-2012 09:56 AM
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 😃
Solved! Go to Solution.
10-03-2012 10:06 AM - edited 10-03-2012 10:06 AM
Is the array being held in a shift register?
Share your code so we have a clue what you have.
10-03-2012 10:08 AM
Yes it is...
10-03-2012 10:10 AM
When you want to clear (whatever that boolean condition is), just wire a 2D array constant to your shift register. See attached.
10-03-2012 10:11 AM
Then wire the empty array into the shift register. You should pass the array through in the cases where the array isn't edited.
10-03-2012 10:15 AM
That was too simple 😃 Thanks...
10-03-2012 11:09 AM
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.
10-03-2012 11:11 AM
Never mind I figured it out 😃 I just need to wire the initailize array again instead of the constant 😃
10-03-2012 11:17 AM - edited 10-03-2012 11:20 AM
@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.