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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Access class private data that is an array of clusters

Solved!
Go to solution

I have a class private data that has an array of clusters. I need to set the data in a class method. I tried to use the array bundle by name but that did not work. There is a step to access the array element that I must be missing. The class private data element is an array is Test, which is a cluster. 

 

image.pngimage.png

This is a snippet from the block diagram. How do I access the Test cluster from the array? Any help appreciated. 

 

 

0 Kudos
Message 1 of 5
(3,092 Views)

It seems like you managed to set the data, now you need to get it back to the class, with Replace array subset and Bundle by name.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 5
(3,082 Views)

I added 2 new VIs "VI for Data member access" to write and read the data. Still not able to write to the class member array cluster data. 

 

image.png

0 Kudos
Message 3 of 5
(3,065 Views)
Solution
Accepted by topic author davidhi

What do you have in write element of test.vi? 

It should be unbundle class, replace subset (make sure array has enough size, otherwise - build array), then bundle back into class.

Read is just unbundle - index array.

PS index better be blue to track rounding errors.

 

0 Kudos
Message 4 of 5
(3,049 Views)

@Alexander_Sobolev wrote:

What do you have in write element of test.vi? 

It should be unbundle class, replace subset (make sure array has enough size, otherwise - build array), then bundle back into class.

Read is just unbundle - index array.

PS index better be blue to track rounding errors.

 


Just to elaborate a bit here on Alex's sage advice:

It won't do to just add an explicit conversion or rounding function here.  Make sure that whatever is calculating this index makes the right integer choice when it comes to non-integer values.  (Which may, of course, turn out to be a simple rounding function - but then at least you've thought it through and decided it's okay to round.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 5
(3,040 Views)