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 resize intensity graph window to fit data automatically

Solved!
Go to solution

I have a 2D array of data where the borders on the data are NaN or (0), could be either but not both, this data is going to an intensity plot.  Is it possible to auto fit the window of the intensity graph to the data that contains values?  I don't know of or can't find a property node element to do this.  

 

 

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

Take the proper array subset and graph only that. (and possibly reset x0, y0 of the axes)

        -or-

Change the x-and y axes to not auto-scale and set the limits corresponding to the data.

 

 

(Note that NaN and 0 ARE values too, of course.)

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

I like the first option, the issue i'm having is searching for the rows and columns for values vs NaN or zero.  If I bring each 1D array in with a while loop i can sum the values, if the sum = (0) then i can delete it, thus the zero values work better that NaN.  Unfortunately this works if the values i want to delete are at the beginning of the 2D array, once they are deleted the array size is changed and i lose the order.  

 

I'm assuming that i'll have to process the master array in terms of columns and then row to reshape it, can you help me figure out the correct way to catch and delete the blank rows/columns at the end of the row/column arrays?

0 Kudos
Message 3 of 7
(2,191 Views)
Solution
Accepted by topic author coolhandLV7

Hi coolhand,

 

when those "blank" elements always are zero then it the check will be easy:

When you also want to test for NaN (or any other value) you may improve the comparison logic…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 7
(2,187 Views)

Great this worked like a champ.  Conditional tunnel huh...never used it.  Thank you very much.

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

NaN.JPG

Here is the "NaN" version in case anyone needs to know, use the Not a Number/Path/Refnum found in the Comparison Menu.  Thanks again.

0 Kudos
Message 6 of 7
(2,168 Views)

Hi coolhand,

 

simple boolean algebra: NOT(x) AND NOT(y) == NOT(x OR Y).

Instead of negating the whole boolean array (after IsNaN?) you could negate the scalar boolean after ORArray.

(It's been a little bit "too picky", but I had to learn a whole bunch of boolean algebra in apprenticeship. I also don't like to use comparison functions on booleans when you can use plain AND/OR/XOR/... operations.)

 

(Maybe in the future the conditional tunnel also supports negating its condition input, so you would not even need this explicit NOT function…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(2,163 Views)