09-20-2013 12:37 PM
Hi everyone,
I am doing a very similar thing as asked in the title post.
I have an array of numeric controls, whose 'number of rows' I set through a separate single numeric control. So far so good.
But the newly created numeric controls are not initialized with zeros etc, therefore, the next code in line freaks out. It doesn't have any outouts from those newly created rows.
I would like to add these number of rows AND at the same time, put zeros to them as well.
Would appreciate any help.
Regards
09-20-2013 01:01 PM
09-20-2013 01:31 PM
The number of visible rows is cosmetic, and has nothing to do with the array size. You need to make sure that the array is resized accordingly. Or you could make the size same as the max number of rows you'll ever need from the beginning.
09-20-2013 01:51 PM - edited 09-20-2013 01:54 PM
Hi Dennis_Knutson & altenbach,
Thanks for looking at my question.
I was so close to the answer, yet so far. You have helped me go get it.
As Denis suggested, I was indeed trying to initialize, and as altenbach pointed out, I realized that the rows being added are just being made visible and not appended to the dimention of the array.
My hurdle was that after initializing the arrays, I get an output array which can only be an indiciator, but I needed an array of controls.
So, just now I used the property node 'Value' and fed it to the output terminal of 'Resize array' and it works.
Problem solved.
Thanks & Regards
PS: The initialization if achieved using 'Initialize array' kept on forcing zeros forever, even when I modified entries in the controls later on.
09-20-2013 03:25 PM
Hi guys,
I guess I was a little fast in replying.
Please find attached a vi utlilizing both the ideas respectively, i.e. Initialize array and Reshape Array functions.
While the Reshape function works, populating all cells with zeros, I would rather have it populate with anything other than zero. Because my code down the line freaks out with zeros.
The Intialize function allows me to put any number other than zero, but then it keeps on forcing that number, even if I change it manually.
Please check the vi and let me know what I am missing here.
Kind Regards
09-20-2013 04:02 PM - edited 09-20-2013 04:02 PM
Well, you would initialzie a 2D array of the desired size and with the desired default value, then replace the original array at position 0,0.
09-21-2013 11:43 AM
Thanks altenbach,
That's what makes it work.
Regards