LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find a row in an array with largest value

Hi, I have this array:

 

0: OBB-9EF6FC (c7:6c:f0:9e:f6:fc) rssi:-53
1: OBB-602842 (c7:6c:f0:9e:f6:fc) rssi:-82
2: OBB-3H6FJ2 (c7:6c:f0:9e:f6:fc) rssi:-84
3: OBB-39DF41 (c7:6c:f0:9e:f6:fc) rssi:-81
4: OBB-494FOB (c7:6c:f0:9e:f6:fc) rssi:-82

 

And I need to find the row with the biggest rssi value, and have this row be an output. How do I do this?

0 Kudos
Message 1 of 11
(2,912 Views)

Iterate through the array using auto-indexing tunnels.  Store the largest value and the index of that value in a shift register.  If you come across a larger value, then you update the shift registers.

0 Kudos
Message 2 of 11
(2,902 Views)

How do I do this? I'm fairly new to labview.

0 Kudos
Message 3 of 11
(2,867 Views)

@mshask wrote:

How do I do this? I'm fairly new to labview.


Where are you stuck? Getting the numbers, or getting the maximum?

 

If it's both, it might be time for some of the (free) courses...

0 Kudos
Message 4 of 11
(2,849 Views)

I'm making a lot of assumption in this solution. Assuming the string before the number is always the same length, and that the - is part of the number. (if its not you just need to change the offset).

But two useful nodes to look at are Array Max & Min, and Decimal String To Number. Both of those basically extract all the data without you doing any work.

Solution.png

 

Message 5 of 11
(2,833 Views)

@ShockHouse wrote:

I'm making a lot of assumption in this solution. Assuming the string before the number is always the same length


You could just use Match Pattern to look for "rssi:" and use the After Substring to convert to a number.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 11
(2,810 Views)

@crossrulz wrote:

@ShockHouse wrote:

I'm making a lot of assumption in this solution. Assuming the string before the number is always the same length


You could just use Match Pattern to look for "rssi:" and use the After Substring to convert to a number.


Or use a good old Scan From String, with "%d: OBB-%6x (%2x:%2x:%2x:%2x:%2x:%2x) rssi:%d" as scan string. Or "%d: OBB-%6x (%[^)]) rssi:%d"  You'd get an integer as a result.

 

Or a regular expression with "rssi:(.*)$", and then use the first capturing group.

0 Kudos
Message 7 of 11
(2,781 Views)

FindBiggest.png

Above Snippet will hold the String Data Array of the respective numeric Value and the Last Element will hold the biggest rssi value.

Hope this helps!

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 8 of 11
(2,759 Views)

Hi Palanive,

 

you should make that "NumericRange" element the first element in the cluster!

(Using AutoCleanup would help, too.)

check.png

(I removed the minus char from the search expression as I guess it is part of the dB value…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 11
(2,747 Views)

GerdW,

Thanks for the update!

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 10 of 11
(2,741 Views)