ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I find the specific coordinates from the 2D array after comparsion?

Hello!

I wish to find the specific coordinates from the 2D array after comparsion.

There is 2D array and Comapre the each cell value of 2D array by some specific number. like '5'
If the cell value is lower than the compare number, No need to find the cell position from the 2D array.

But if the cell value is greater than the compare number,
at this time I want to get this cell position from the whole 2D array.

The position show as 3(row) and 68(column) and I wish to put the new value in a new array one by one.
(I mean build new array by the position number which are the row and column)

I trying to solve this matter, but I couldn't...
Please help me to fine good solution and advice me.

Thank you~
0 Kudos
Message 1 of 3
(3,488 Views)
A couple of issues are not clear.

Is the new array the same size and do you want to place the high values at the same position on the new array?
What should be in the elements in the new array that are not populated (zero, NaN, etc)?
Why does it need to be one-by-one?

If you just want a new 2D array containing only the high elements while keeping the other elements at zero, you could do it in one step as in the attached VI (LabVIEW 7.0). If this is not what you want, please explain in more detail and maybe attach an example.
0 Kudos
Message 2 of 3
(3,479 Views)
Altenbach, I think RedWolf wants the location of those elements.
In that case, you have 2 options.
You can build a function to search for all the elements of a 1D array and output them, then use a for loop to search each line of the array (example attached - 7.0),
or you can go over every element of the array by placing a for loop inside another for loop. Then, use the i terminals from both for loops to build your array.
In both cases, you will need to use a shift register on both loops in order to add only some of the elements to this array and use at least one i to determine where you are.

Edit: I actually remembered I already wrote a VI for this, so I'll attach it as well. Hell, I'll just throw in the entire polymorphic VI.

Another edit: Since you want 5 or larger, you will have to go over all the elements of the array, so this method, of using search array, will not help you.

Message Edited by tst on 05-04-2005 10:27 AM


___________________
Try to take over the world!
Download All
Message 3 of 3
(3,470 Views)