From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Creating a vector by comparing values in two other vectors
Date: Sat, 03 Sep 2011 12:50:00 -0500
Organization: NNTP Server
Lines: 17
Message-ID: <j3tpcj$ije$>
References: <j3torj$h6o$>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20110616 Thunderbird/3.1.11
X-Notice: Filtered by postfilter v. 0.8.2
Xref: comp.soft-sys.matlab:742147

On 9/3/2011 12:41 PM, Ulrik Nash wrote:

> when a given value in B is larger than the corresponding value in A,
> then the corresponding value in C is -1, otherwise 1.

Come on, you're not even trying here... :(

W/O being clever at all,

C=ones(size(A)); C(B>A)=-1;

There are any number of ways to make it work in one step; thinking of 
one of them is left as "exercise for the student"