LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I update a cluster that is in an array?

Solved!
Go to solution

I have an array composed of six clusters called "Station". I'm getting values that I would like to store in each of the six clusters in the "WO" and "SN" strings from a subvi that outputs an array of six values of WO and SN. How do I do this?

 

Thank you.

0 Kudos
Message 1 of 12
(3,475 Views)
Solution
Accepted by topic author chuck72352

You did not include the subVI.

 

Looking at the VI you have attached:

You need to keep the array in a shift register or do autoindexing. Do you always start with an empty array?

Message 2 of 12
(3,471 Views)

In my real application I dont always start with an empty array.

Download All
0 Kudos
Message 3 of 12
(3,465 Views)

Sub VI  left out.

0 Kudos
Message 4 of 12
(3,464 Views)

Why does SN to F array have a 100ms delay in the loop? that just slows you down. It also does not need a shift register for the status, just autoindex at the right loop boundary. Also, of you are autoindexing on an array, you typically should not wire N.

 

Also the "input subVI" seems overly complicated. The reset to defaults is not needed since the buttons are latch action. Simply make sure the terminals are inside their respective event case. The 100ms delay makes no sense. All you need is a single while loop, don't build while loop pyramids.

 

Your toplevel VI makes not much sense. Where do the other values of the cluster come from. Is the input cluster always size=6? Can it in principle grow without limits after a while?

 

 

 

Message 5 of 12
(3,439 Views)

Thanks for the advice. I'll make the corrections. The VI posted comes from a much larger vi and is taken out of context. The size is always six. I've been able to get a little closer to what I'm trying to do...but still have a way to go.

0 Kudos
Message 6 of 12
(3,437 Views)

Attached is the real application. The problem Im  having is in the middle loop and the "P_wo sn" case.

0 Kudos
Message 7 of 12
(3,436 Views)

If the size is always size, and you get six elements each from the subVI, the easiest would be the following.

 

(Of course th input cluster needs to have six elements. If you don't get it from a input connector, make at least sure that the default array control contains six elements. In this example, all input elements remain the same, except for the update fields.

 

 

(I haven't looked at your zip file yet)

 

 

Message 8 of 12
(3,424 Views)

Thank you for your solution. Once I put data into my input array it worked fine. It was taking the smallest index which was 0 when the input array was empty. What I can do is create an unused element in my array and create a default value for it so that the array will never be empty when the application begins.

 

 

Thanks again!

0 Kudos
Message 9 of 12
(3,417 Views)

Go to the array on the front panel, and click one of the controls of the sixth element (e.g. enter 0 in one of the numerics) so the array has a size=6. Now right-click the array...advanced...make current values the default. Save the VI.

Message 10 of 12
(3,415 Views)