Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: ismember - getting wrong result
Date: Mon, 16 Mar 2009 07:42:09 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 28
Message-ID: <gpkvsg$dbq$1@fred.mathworks.com>
References: <gpb180$5uv$1@fred.mathworks.com> <gpk4m9$7mg$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1237189329 13690 172.30.248.35 (16 Mar 2009 07:42:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 16 Mar 2009 07:42:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:525131


"Niklas " <nn@hotmail.com> wrote in message <gpk4m9$7mg$1@fred.mathworks.com>...
> try linspace. it works for me:
> 
> a=linspace(0,1,11)
> [b,c]=ismember(0.3,a)
> 
> 
> Answer:
> b =
>      1
> c =
>      4

You are simply lucky that day.

>> a=linspace(0.1,1,10);
>> [b,c]=ismember(0.7,a)
b =
     0
c =
     0
>> [b,c]=ismemberf(0.7,a)
b =
     1
c =
     7

% Bruno