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$>
References: <gjd87p$q3m$> <> <gjdgg6$kme$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1230677463 4199 (30 Dec 2008 22:51:03 GMT)
NNTP-Posting-Date: Tue, 30 Dec 2008 22:51:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: comp.soft-sys.matlab:509278

"Tamar Friedlander" <> wrote in message <gjdgg6$kme$>...
> 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.