05-07-2009 10:36 AM
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?
05-07-2009 11:42 AM - edited 05-07-2009 11:44 AM
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"
05-07-2009 11:51 AM
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
05-07-2009 12:06 PM
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
05-08-2009 05:58 PM
04-01-2019 08:20 PM
@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.
04-01-2019 09:39 PM
That person hasn't been on the forum in nearly a decade. I doubt they'll see your message to reply.
04-01-2019 09:43 PM
@RavensFan 작성:
That person hasn't been on the forum in nearly a decade. I doubt they'll see your message to reply.
Thanks RavensFan,