Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Find Recurrence in matrix.
Date: Thu, 7 Oct 2010 08:58:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <i8k22t$boa$1@fred.mathworks.com>
References: <i8ju5b$nhg$1@fred.mathworks.com> <i8k0v9$14l$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1286441885 12042 172.30.248.37 (7 Oct 2010 08:58:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 7 Oct 2010 08:58:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2546024
Xref: news.mathworks.com comp.soft-sys.matlab:676475

Following command finds the recurrence for 4 in the matrix a.
length(find(a==4))

"Grzegorz Knor" <gknor@o2.pl> wrote in message <i8k0v9$14l$1@fred.mathworks.com>...
> "Atakan " <cesimkaol@gmail.com> wrote in message <i8ju5b$nhg$1@fred.mathworks.com>...
> > I could not find in MATLAB HELP function that easy way to calculate recurrence in data.
> > 
> > 
> > For instance ;
> > 
> > a=[1,2,3,4,5,6,2,3,4,2,3,4,5,1,2,1,2,3,4,5,6,4] &#305; want to calculate recurrence of 4 ,&#305; am curious about that matlab has special function for calculate recurrance
> > 
> > recurrence for 4 is 5
> > recurrance for 3 is 4
> > recurrance for 1 is 3
> > 
> > Waiting your answers...with best regard :)
> 
> DOC UNIQUE, REPMAT, BSXFUN.
> 
> For example:
> u = unique(a);
> u2 = repmat(u',1,length(a));
> [u' sum(bsxfun(@eq,u2,a),2)]
> 
> Grzegorz