07-30-2014 08:17 AM
Hello.
I have two 2D Arrays (9x9) and I would like to find indices of an element that lies in a specific range. For example, ±15% of the value I look for. I have found and implemented Search 2D Array.vi, it works well but it is possible to set only one number to search for, not a range. So, I am stuck at this stage.
Any help is highly appreciated!
Thanks.
Solved! Go to Solution.
07-30-2014 08:21 AM - edited 07-30-2014 08:21 AM
I am not really clear about your question. Do you mean, if you have a value (lets say 100) so you want to find the numbers between 85 to 115? Also your Search 2D array VI is missing in your attachement.
07-30-2014 08:22 AM - edited 07-30-2014 08:25 AM
07-30-2014 08:27 AM
Oh, sorry. Here is the VI.
Yes, you are absolutely right. If the value is 100, then I would like to find numbers in the range 85 - 115. Here 15% is like a permissible error.
07-30-2014 08:29 AM
Thanks for your reply.
How can I get indices in this case?
07-30-2014 08:30 AM
07-30-2014 08:42 AM
Here is an implementation of GerdW's concept. Note that it does not distinguish between valid zero value indexes and the default in the array. You will need to decide how to manage that situation.
Lynn
07-30-2014 08:46 AM
Thank you! I`ll try this method.
07-30-2014 10:49 AM
Lynn,
I am confused a bit. Please look at the attached image. Range is 0,54-0,66. I think that the first value in Indexes array is number of row and the second is number of column, am I right? If so, (0,0) corresponds to 0.678852, (0,2) is 0.209174 which is out of the range. But (1,0) is 0.574114 which lies within the limits. However, somehow 0.56365 and 0.652643 (circled in green) have not been detected...
Another question is what does it mean when only one column in Indexes array is active?
Also this VI cannot cope with negative values due to terminals mismatch in in Range and Coerce.vi. So probably I need to make two of them for both positive and negative values.
Actually every element in the arrays from VI I attached previously corresponds to a specific point in a plane (a metal sheet). It means that if two pairs of indices are equal then the specific point is found. So, I need only one pair of indices, otherwise mismatch occurs.
Thanks for your help!
07-30-2014 11:19 AM