LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically resize visible initialized array

Solved!
Go to solution

 

Hi,

I'm trying to create a dymamic 2D array whereby the user inputs how many rows he would need. 

This is what I have built so far and it works to some extent...

VI.jpg

The problem I have is that  in the VI the array does not grow/shrink according to the user input. What I mean is if for example I have 2x2 array in the VI, and I run it,

If I enter Number of Row = 1, the 1st row is initialised while the second row is greyed out.

If I enter Number of Row = 2, the 1st and 2nd rows is initialised.

If I enter Number of Row = 3, the 3 rows is initialised but only 1st and 2nd rows visible!

Is there any property node I can use to grow/shink the array in the VI so that only the initialised rows are visible?

0 Kudos
Message 1 of 6
(3,049 Views)

Hi sherzaad,

 

what about the "number of rows" property?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,038 Views)

Funny you should say that... I did try that property node originally but still the same problem...

The number of rows is updated but on the VI, the number of visible element in the array do not change ie.

If the user inputs number of rows > original array drawn on the VI, the extra rows are not visible

If the user inputs number of rows < original array drawn on the VI, non-initialised rows are greyed out but that does not stop the user inserting a value into them

 

Alternatively, if I could lock out the greyed out elements to stop the user initialising those, I could work with that. 

 

0 Kudos
Message 3 of 6
(3,034 Views)

Hi sherzaad,

 

The number of rows is updated but on the VI, the number of visible element in the array do not change ie.

Please attach a VI demonstrating the problem!

 

if I could lock out the greyed out elements to stop the user initialising those, I could work with that. 

There are solutions to this problem, but I would start with debugging your example VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(3,029 Views)

It worked perfectly for me.  Here's a question -- did you possibly forget the Prime Principle of LabVIEW, namely the concept of Data Flow?  You cannot set the number of Rows and Columns of the Indicator until after you have initialized (and set the size of) the Array, itself.

 

"I'll show you mine if you show me yours".

 

Bob Schor

Message 5 of 6
(3,025 Views)
Solution
Accepted by topic author sherzaad

@Bob_Schor wrote:

It worked perfectly for me.  Here's a question -- did you possibly forget the Prime Principle of LabVIEW, namely the concept of Data Flow?  You cannot set the number of Rows and Columns of the Indicator until after you have initialized (and set the size of) the Array, itself.

 


Thanks for that reminder! keeping that in mind I added a couple of extra block and Voilà! It works! The number of rows in the VI Array control updates with user input.

snip.jpg

0 Kudos
Message 6 of 6
(2,987 Views)