LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with searching through array

 

Results.JPGSo I've been troubleshooting this for a while now and I've run out of ideas. For some reason select values don't find a match and I cannot figure out why. I have attached all the files needed to run the program. I would do images but I figure this might be easier. I also have an image of the results. First column is before rounding, second is after rounding and third is if a match was found it returns the index of the array we are matching against.

0 Kudos
Message 1 of 3
(2,155 Views)

The third column isn't returning the index of the array, it's returning the value at that index. Basically, columns 2 and 3 will be the same if there was a match, and it will be zero if there isn't a match. If Index Array receives an Index of -1, it'll return a 0, which your code appears to be doing.

 

I'm not quite sure what the problem is here, can you elaborate? If you want the third column to be the Index of the match, not the value matched, remove the Index Array function.

0 Kudos
Message 2 of 3
(2,123 Views)

@BertMcMahan wrote:

I'm not quite sure what the problem is here, can you elaborate? If you want the third column to be the Index of the match, not the value matched, remove the Index Array function.


I agree with that. Should be easy to fix. 😉

 

(Some extra comments: There is no reason to have the "round to even" in a separate loop, this can easily be done in the second loop, eliminating the first loop. Not sure why you have all these representation mismatches (SGL vs. DBL). I have the gut feeling that more simplifications are possible)

0 Kudos
Message 3 of 3
(2,109 Views)