Skip to content
Back to formatted view

Raw Message

Message-ID: <78F28735-C69C-40A2-A52D-159B47ACA702@comcast.net>
Date: 2011-04-05T22:59:42Z
From: David Winsemius
Subject: Search arrays based on similar values
In-Reply-To: <1302042890316-3429381.post@n4.nabble.com>

On Apr 5, 2011, at 6:34 PM, mjdubya wrote:

> Hey folks,
> I have two arrays: "A" (1X100) with non-ordered values ranging 1-14
>                          "B" (2X14)  containing 14 decimal values.
> I would like to create a new array (1X100) that contains only the  
> decimal
> values from array B by associating the integers from A and B.  In  
> other
> words, for each value of A find the same integer value of B, select  
> the
> associated decimal value of B.

Sounds like a job for merge(). Tested solutions offered when  
reproducible examples are provided.

>
> A          B         newarray
> 1       1  0.1         0.1
> 1       2  0.3         0.1
> 1       3  0.14       0.1
> 2       4  0.2         0.3
> 3       5  0.82       0.14
> 3       6  0.21       0.14
> 4        .   .          0.2
> 7        .   .           .
> 14      .   .            .
> 4      14 0.03        .
> 3                        .
> 5                        .
> .                         .
> .                         .

David Winsemius, MD
West Hartford, CT