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: 

How to highlight elements of a large 2D array?

Solved!
Go to solution

Hello,

    I am guessing the answer is "you cannot", but I thought I might ask anyway. So I am dealing with a very large 2D array. I am then pulling out every nth element to form another 1D subarray, which I am then graphing. I thought it might be useful for a user to be able to see the original 2D array elements, to scroll though, and see the actual data values that were used for the graph. I already have the subarray graphed. Is there any "easy" way to highlight, change font color, etc, for all of the elements that were pulled out of the original array?

     I think this is one of those "how much time and effort" is required LabVIEW questions. It is not critical to what I am doing, but if there is an "easy" way to do this, it might be worthwhile to add it. Thanks....

0 Kudos
Message 1 of 7
(2,953 Views)

Short answer: You cannot modify specific elements of the array, color, font, etc.

 

However, if you use a table control and change "ActiveCell" under properties to the desired locations, you can change almost anything you can think of.

0 Kudos
Message 2 of 7
(2,945 Views)

Let's say you have an array with a million entries, and you select every thousandths, so your sub-array has 1000 elements and if you could highlight these entries in the original array, you'd have 1 highlight, 999 regular, 1 highlight, 999 regular, etc.  How useful would this be?

 

However, if you create a "sub-set" array (using the appropriate Array function) so that you have an array with the 1000 "selected" elements, you can simply wire the Array to an Indicator, give the Indicator a Scroll bar (for easy navigation), and, as they say, "Bob's Your Uncle".

 

Bob Schor

0 Kudos
Message 3 of 7
(2,944 Views)

How is the 2D array displayed? (intensity graph, etc.)

 

What you could do is display the decimated array on one indicator and a subset in a second indicator. Whenever one element is selected, the "zoomed" indicator would grab an appropriate subset of the full array near the selected element and display it. This keeps the data on the front panel manageable at all times. For the intensity graph, you could even overlay a square (plot images.front) to show the area of the zoomed subset indicator. It could be made fully interactive.

 

Here's how to interactively draw a line, but you could easily draw a square to define the subset. (I posted an example long ago, maybe somebody can find it...)

0 Kudos
Message 4 of 7
(2,930 Views)

In an array, the formatting on all cells has to be the same.  It's only the data that can differ.  So you can't make just some cells bold, or have a different text color, or whatever.

 

However, there's a fun workaround, in that a "color box" control has its data also work as its color appearance.

 

So, if your array is (for instance) a 2D array of floats, change it to a 2D array of clusters, containing a float and a color box each.  Arrange the control so that the float is in front, with a transparent background.  The color box is in the back, same size and location as the float display area, and set to either your default "window grey" if not highlighted, and another color to make it highlighted.

0 Kudos
Message 5 of 7
(2,924 Views)

The data being extracted from the 2D array is concatenated together and mathematical operations are done to each element before graphing. This was much more the idea of once the data is calculated and graphed, you might want to go back to the original 2D array, that is shown as an indicator, and highlight in some way, the elements that were used. 

 

So to get a bit more specific:

 

Lets say the array is 300 bytes wide by 100000 long. In the 2D array, each column represents a data field. For a specific data field, I locate the appropriate column, then extract out every n samples, and then concatenate together the next 4 bytes, to do mathematical operations on. Then this 1D array is plotted.

 

What I was looking to do, is be able to go back to the 2D graph indicator, and see highlighted, the various bytes in column X that were extracted out to use in the graph. Just to make sure the calculations done on the "raw" data was correct, etc.

0 Kudos
Message 6 of 7
(2,915 Views)
Solution
Accepted by topic author Z4CRUZN

Make it an array of clusters; the cluster containing a numeric and a color box, both the same size.
Put the color box behind the numeric, giver the numeric a transparent background.

"If you weren't supposed to push it, it wouldn't be a button."
Message 7 of 7
(2,896 Views)