From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to NOT get the first element as the max when elements are equal
Date: Fri, 11 May 2012 05:35:25 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <joi8et$g99$>
References: <johivn$ni4$> <johr01$o50$> <joi6n4$9oa$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1336714525 16681 (11 May 2012 05:35:25 GMT)
NNTP-Posting-Date: Fri, 11 May 2012 05:35:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:767466

"Yildiray Yildiz" wrote in message <joi6n4$9oa$>...
> Excellent! Thank you, Roger. One note: For some reason t(f) = rand(length(f),1) did not work.
> I had to do:
> t = t*rand;
> t(f) = rand(length(f),1);
> Although I do not know why I had to modify the "t" matrix first, it worked.
- - - - - - - - -
  The "t(f) = rand(length(f),1);" line works on my matlab version without modifying t first, but it is a very old version.  Probably the "t = t*rand;" simply serves to convert 't' from a logical array to a numerical one with 1's and 0's.  If so, you can probably just do "t = t+0" or "t = double(t)" instead.

Roger Stafford