LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare array , search for for 2 depending values and output matching elements

Hi,

my  problem is to extract elements from a 2d array imported from excel. For example i need the elements from a row , where the value of column 1 and 2 match 2 values i want to set (differnt values for column1 and 2 / later theese are measured).I tried this by using the index array and search array function and wanted to compare the index of the  columns where the values appeared with a simple case structure and than extract the desired elements with another index array function ,but this doesn't work.

 

How can manage it ,that the search1d array function doesn't stop at the first matching element , and how could i compare the resulting index with another one from the 2nd column ( making a comparison with  the equal function send through a case structure didn't work for me).

 

Any ideas? 

 

0 Kudos
Message 1 of 8
(3,205 Views)

I'm not sure I entirely understand what you are trying to do.
If I understand correctly:

This will iterate through each row of '2D array'.

It will check the value of 'column 1' vs 'value 1' that you specify.

It will do the same for 'column 2' and 'value 2'.

 

If 1 is a match AND 2 is a match, it will say "you have a match"

If not, it will say "no match"

Message Edited by Cory K on 05-07-2009 11:44 AM
Cory K
0 Kudos
Message 2 of 8
(3,191 Views)

Using = to compare non-integers is not a good idea.  Due to the way numbers are represented in the computer, equality matches do not work as you might hope they would.  It is better to use the In Range and Coerce or similar logic with the upper and lower limits changed from the nominal value by the Machine Epsilon (I think that is what it is called) or more.  Machine Epsilon is the smallest difference between two numbers which can be represented by the corresponding datatype (DBL for example) on that computer.

 

Lynn 

Message 3 of 8
(3,185 Views)

johnsold wrote:

Using = to compare non-integers is not a good idea.  Due to the way numbers are represented in the computer, equality matches do not work as you might hope they would.  It is better to use the In Range and Coerce or similar logic with the upper and lower limits changed from the nominal value by the Machine Epsilon (I think that is what it is called) or more.  Machine Epsilon is the smallest difference between two numbers which can be represented by the corresponding datatype (DBL for example) on that computer.

 

Lynn 


 

Ditto Lynn's comments.

 

Your question alomst reads like you are trying to map values to scales (not sure). If so check out the "Threshold 1D Array" and its counter-part the "Interpolate 1D Array". You pass a measured value to the first, it finds an index that matches the value you are trying to map and then use that as the input to the Interpolate and it will give you the value that matches up from the second array and will perform a linear interpoaltion if in-between.

 

Have fun!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 8
(3,175 Views)
Thanks to all of you, but I already could fix my problem. Sorry that I haven´t replied earlier I was a quite busy.
0 Kudos
Message 5 of 8
(3,145 Views)

@Student111  작성:
Thanks to all of you, but I already could fix my problem. Sorry that I haven´t replied earlier I was a quite busy.

hy could you please upload that problem solution.

0 Kudos
Message 6 of 8
(2,212 Views)

That person hasn't been on the forum in nearly a decade.  I doubt they'll see your message to reply.

0 Kudos
Message 7 of 8
(2,206 Views)

@RavensFan  작성:

That person hasn't been on the forum in nearly a decade.  I doubt they'll see your message to reply.


Thanks RavensFan, 

0 Kudos
Message 8 of 8
(2,204 Views)