07-22-2019 08:36 AM
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?
07-22-2019 08:51 AM
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.
07-22-2019 09:23 AM
How do I do this? I'm fairly new to labview.
07-22-2019 09:48 AM
@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...
07-22-2019 10:16 AM - edited 07-22-2019 10:17 AM
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.
07-22-2019 10:58 AM
@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.
07-23-2019 02:47 AM - edited 07-23-2019 02:52 AM
@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.
07-23-2019 05:30 AM - edited 07-23-2019 05:31 AM
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!
07-23-2019 05:45 AM - edited 07-23-2019 05:48 AM
07-23-2019 06:18 AM
GerdW,
Thanks for the update!