LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count The colored fields of a 2D array

Solved!
Go to solution

HI, is there a way to know hoy many fields of a 2D array are colored?

 

i want to count ta painted fields of this table 

regards

0 Kudos
Message 1 of 12
(2,820 Views)

You can use for loops to set the active cell and then read the background color for each cell using a property node.

Table Properties.png

 

Then just check to see if the color matches what you're looking for.

 

Rob

0 Kudos
Message 2 of 12
(2,811 Views)

you mean put the array in a for loop in order to get the cells and with that set the active cell?

do you have an example so i can check it out?

thanks a lot

0 Kudos
Message 3 of 12
(2,807 Views)
Solution
Accepted by topic author Tokyghy

You have to check each cell and see which ones have the color you're looking for. Sort of like this:

 

Counting Colored Cells.png

 

Interesting that it replaced the reference with a reference control. Data Table 2 should be a reference to Data Table.

 

Rob

0 Kudos
Message 4 of 12
(2,792 Views)

@Robert Cole wrote:

 

 

Interesting that it replaced the reference with a reference control. Data Table 2 should be a reference to Data Table.

 

Rob



Use the Code Capture Tool.  It doesn't have that problem the way the VI Snippet built into LabVIEW does.

0 Kudos
Message 5 of 12
(2,789 Views)

THANKS FOR HELPING 😉

0 Kudos
Message 6 of 12
(2,765 Views)

I have a 1D array of Booleans. How do I count how many times True came up?

0 Kudos
Message 7 of 12
(2,743 Views)

Maybe this can help, it almost the same code as the above one

0 Kudos
Message 8 of 12
(2,737 Views)

@Eric1977 wrote:

I have a 1D array of Booleans. How do I count how many times True came up?


FIrst of all, you should start a new thread, because the current thread is marked as solved and this is a new problem. 

 

 

All you need is the following.

 

 

 

(If the array will be larger than the range of I16, insert a to_I32 before summing.)

Message 9 of 12
(2,729 Views)

@Tokyghy wrote:

Maybe this can help, it almost the same code as the above one

 


 

This is way too convoluted!

 

Hmm.... ever wondered what would happen if you would remove the "equal TRUE" and simply wire right across to the select node???? Scratching head....

 

(See also everything ever posted in the Rube Goldberg thread)

0 Kudos
Message 10 of 12
(2,719 Views)