04-21-2017 01:30 PM
My goal is to change the array size of elements from 25 to 50 each time I select a different. I am probably going the wrong way with this because I tried using a local variable and it keeps increasing until it crashes.
which better way I can do this.
If I block value is 0, array should display in front panel 25 boolean, if 1, it should display 50 Booleans (that's the tricky part). I cant seem to reinitialize the array after it increases by 25.. it keeps increasing.. Please help...
Solved! Go to Solution.
04-21-2017 01:36 PM
"each time I select a different ....." a different what?
You aren't doing anything with your shift register, so you really aren't increasing any size of array.
If you were, then it would grow quickly and blow up LabVIEW because you have an infinite while loop that is running as fast as it can.
What do all of these booleans represent? What are you trying to do with them when you aren't changing the control from 0 to 1 or back to 0?
04-21-2017 01:45 PM
The Booleans represent an array of channels. for block (G,H,I) there are 25 channels. for I there are 50 channels. I want to give a user the choice to select which channel to turn on by displaying all available channels when a specific block is selected.
I think I was coding it wrong and I may need help going in the right direction
04-21-2017 02:06 PM
Hi ritch,
I may need help going in the right direction
Well, I recommend to use an event structure!
You need:
- value change event for your "block" control. For block=0 you limit your array to 25 channels (using ArraySubset). For block=1 you limit the array to 50 elements by appending 25 channels/bits, followed by ArraySubset with length=50 (for safety :D)
- value change event for "Array" to update any hardware outputs…
I also recommend to hide the index display of the array and disable any right-click menus for the array control so the user cannot add/delete any channels by mistake.
04-21-2017 02:08 PM - edited 04-21-2017 02:16 PM
I'm still confused on what your code should be doing. Can you list out the steps that your code should be performing.(ie. 1. Wait for user input. 2. Pass user input to main program loop. 3. ...)
PS. Would you maybe consider using a tab control? http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/creating_tab_controls/
04-21-2017 02:18 PM
1-Load default array of 25 Booleans
2- if user select block (J), add 25 more elements to the default array starting from the last index.
3- show all 50 Booleans elements in front panel
4- if user select block (G-H-I),do nothing use default array
5-show all 25 Booleans elements in front panel
04-21-2017 02:21 PM
Thanks..this code will be used in a bigger code that already have a event structure that execute only by another butter. I don't want my loop to execute when block value changes.
04-21-2017 02:22 PM - edited 04-21-2017 02:24 PM
Hi ritch,
I made a quick example (LV2016)…
Edit after reading your new messages:
I don't want my loop to execute when block value changes.
Well, your code should react on user input but without executing your code? That's a tough requirement!