Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: 'find' returns non-integer indices (potential bug?)
Date: Tue, 30 Dec 2008 22:51:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <gje8km$437$1@fred.mathworks.com>
References: <gjd87p$q3m$1@fred.mathworks.com> <MPG.23c40a995544ece0989912@news.mathworks.com> <gjdgg6$kme$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1230677463 4199 172.30.248.37 (30 Dec 2008 22:51:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Dec 2008 22:51:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: news.mathworks.com comp.soft-sys.matlab:509278

"Tamar Friedlander" <tammy_in_the_andes@yahoo.com> wrote in message <gjdgg6$kme$1@fred.mathworks.com>...
> My code (a little simplified) is this:
> 
> dilution = rand (size(S)) > ((length(S) - N0) / length(S));
> diluted_S = S (find(dilution));
> S = diluted_S;  
> 
> There is no arithmetics involved. What I do is randomly choose some of the indices in 'S' and throw them away.
> 
> Occassionally, this causes an error with error message about non-integer indices, while most of the time the code works properly.

What was the error message?

> I checked, and to my surprise the indices returned by 'find' were indeed non-integers!

How, precisely, did you check this in the above code? 

> 
> Any idea?
> 

Not yet, you need to give more detailed information.

Jos