Re: Matching Pairs (playing with arrays)
- From: "Michael Robbins" <michaelNOrobbinsSPAMusenet@xxxxxxxxx>
- Date: Thu, 28 Jul 2005 19:15:59 -0400
dc wrote:
>
>
> Hi all,
>
> I am curious if anyone has any experience with this, or if a
> function
> has been created for it. Basically, from two arrays of equal or
> unequal lengths, I want to match the closest values to each other.
> For instance:
>
> x = [5 3 1 4 2];
> y = [1.1 2.1 3.1 4.1 5.1];
> would match: 1 with 1.1, 2 with 2.1, etc.
>
> Thanks,
> DC
Assuming this is not a homework problem...
for i=1:length(x)
yclosest2x(i) = min(y>x(i));
end;
.
- References:
- Matching Pairs (playing with arrays)
- From: dc
- Matching Pairs (playing with arrays)
- Prev by Date: Re: syntax again!
- Next by Date: Re: [FEVAL][INLINE] Does the target function have
- Previous by thread: Matching Pairs (playing with arrays)
- Next by thread: "latest version of matlab app-defaults file not found" (OS X)
- Index(es):
Relevant Pages
|