Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Sorting of Data Lists



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




  • Prev by Date: RE: Help
  • Next by Date: ISO data management, graphing, and visualization
  • Prev by thread: Re: Sorting of Data Lists
  • Next by thread: Re: Sorting of Data Lists