LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete elements from array during runtime with 1d array of cluster

So I want to have a 1d array of clusters containing two elements: a button and a string control. These buttons should delete elements from a 1d array if they are off, and keep them if they are on. The string control should display the unique elements occuring in the 1d array. There will only be about 5-6 unique elements with duplicates occurring so it can fit on the front panel with ease. I imagine it looking something like this. Since C,D and E are the only ones that are turned on, they are the only elements that exist in the output array. How do I implement this? I am not sure how to populate the array of clusters with the unique elements programmatically.

 

Asasafuchi_0-1736756384259.png

 

0 Kudos
Message 1 of 18
(166 Views)

If Array 3 contains all elements it's very simple, just loop through Array 3 and extract the string with a Conditional output, Done.

 

Yamaeda_0-1736757163908.png

 

 

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 18
(157 Views)

Yes if it contains the elements I can do that, but how do I populate it programmatically? It will start off as an empty unitialized 1d array of clusters.

0 Kudos
Message 3 of 18
(145 Views)

Hi Asasafuchi,

 


@Asasafuchi wrote:

but how do I populate it programmatically? It will start off as an empty unitialized 1d array of clusters.


By writing data to this array of clusters.

Where does the data come from???

Best regards,
GerdW


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

Hi Gerd,

 

The data will come from a 1d array containing all unique elements that appear in the 1d array containing all elements. The goal is first to populate the 1d array of clusters with the unique elements in the strings and set all button controls to true as default. After that I want to be able to use the buttons to delete elements from the original array and display the output array.

 

Asasafuchi_1-1736758999474.png

 

 

0 Kudos
Message 5 of 18
(126 Views)

Hi Asasafuchi,

 


@Asasafuchi wrote:

The goal is first to populate the 1d array of clusters with the unique elements in the strings and set all button controls to true as default. After that I want to be able to use the buttons to delete elements from the original array and display the output array.


use Yamaeda's suggestion, but only in the reverse order. Use BundleByName instead of UnbundleByName in the loop!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 18
(120 Views)

Hi Gerd,

 

I don't really understand how this could be done in reverse since I need to first populate the array of cluster with the unique elements and set all buttons to true. so the 1d array of cluster will be changed dynamically. Could you attach a vi showing how this could be done in reverse?

0 Kudos
Message 7 of 18
(104 Views)

Yamaeda_0-1736763009868.png

 

You probably want an Event structure and such for a better UI, but this should give some ideas.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 18
(96 Views)

Thanks! This seems to populate the array correctly but turning the buttons on/off do not change Array 2. Are your buttons working? 

 

Asasafuchi_0-1736763656694.png

 

0 Kudos
Message 9 of 18
(88 Views)

Hi,

 

I am not sure how that would be useful in any real-world application, but here you go:

raphschru_0-1736763567922.png

raphschru_1-1736763589091.png

 

Regards,

Raphaël.

Message 10 of 18
(88 Views)