Re: Sorting of Data Lists
- To: mathgroup@smc.vnet.net
- Subject: [mg11046] Re: Sorting of Data Lists
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Wed, 18 Feb 1998 20:31:47 -0500
- References: <6camtn$fe8@smc.vnet.net>
CFreitas@swri.edu wrote:
>
> I have two equal length vector sets of data. I wish to form a third vector
> whose elements are the minimum values from each component of the other two
> vectors; i.e., if a(i) < b(i), then c(i) = a(i), else c(i) = b(i).
Christopher:
In[1]:=
v1= {1,4,3};
In[2]:=
v2 ={3,2,0};
In[3]:=
v = MapThread[Min,{v1,v2}]
Out[3]=
{1,2,0}
Another way
In[4]:=
v= Min/@Transpose[{v1,v2}]
Out[4]=
{1,2,0}
--
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642