Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!feed4.jnfs.ja.net!jnfs.ja.net!gemini.csx.cam.ac.uk!news.cam.ac.uk!tpl
From: tpl@eng.cam.ac.uk (Tim Love)
Newsgroups: comp.soft-sys.matlab
Subject: Re: find function
Date: 5 Jan 2009 13:06:28 GMT
Organization: University of Cambridge, England
Lines: 11
Message-ID: <gjt0kk$976$1@gemini.csx.cam.ac.uk>
References: <gjt08k$mt1$1@fred.mathworks.com>
NNTP-Posting-Host: last.eng.cam.ac.uk
Xref: news.mathworks.com comp.soft-sys.matlab:509839


"Branko" <branko_b@hotmail.com> writes:

>Let's say that I have a random matrix:
>A=ceil(randn(10,1));
>and I want to find -1 and 2 values in the matrix. Which is done by following command
>a=find(A==-1);
>b=find(A==2);
>However I' d like to use single command which in this case is:
>c=find(A==-1 & A==2);
>But I got empty matrix.Where is the cache. 
The catch? You need OR, not AND, so you need | rather than &