Prev: How to perform a harmonic analysis of a periodical data? FFT or
Next: Changing mask parameters from a m-function
From: burcu on 11 May 2010 15:23 Seems i have another problem. Tried the code with my data which includes 5 different values on a 800 lined col vec. my tm is a matrix of 350x350. any idea why cant i get a 5x5 matrix? Burcu > > > > > well... ACCUMARRAY typically is used (by most CSSMers) to create transition matrices... and, unless i completely misunderstood what you need... > > > > one of the solutions > > > > v=[2,3,4,3,5,2,3,5,2,3,4,2,1].'; % <- note: col vec > > tm=accumarray([v(1:end-1),v(2:end)],1) > > %{ > > % tm = > > 0 0 0 0 0 % <- eg, no transition 1-> > > 1 0 3 0 0 % <- eg, transition 2->3 occurs three times... > > 0 0 0 2 2 > > 0 1 1 0 0 > > 0 2 0 0 0 > > %} > > > > us
From: us on 11 May 2010 15:34
"burcu " <burcu102(a)hotmail.com> wrote in message <hscaqp$g44$1(a)fred.mathworks.com>... > Seems i have another problem. Tried the code with my data which includes 5 different values on a 800 lined col vec. > my tm is a matrix of 350x350. any idea why cant i get a 5x5 matrix? > > Burcu > > > > > > > > well... ACCUMARRAY typically is used (by most CSSMers) to create transition matrices... and, unless i completely misunderstood what you need... > > > > > > one of the solutions > > > > > > v=[2,3,4,3,5,2,3,5,2,3,4,2,1].'; % <- note: col vec > > > tm=accumarray([v(1:end-1),v(2:end)],1) > > > %{ > > > % tm = > > > 0 0 0 0 0 % <- eg, no transition 1-> > > > 1 0 3 0 0 % <- eg, transition 2->3 occurs three times... > > > 0 0 0 2 2 > > > 0 1 1 0 0 > > > 0 2 0 0 0 > > > %} > > > > > > us don't top post; it's tedious... anyhow, remember what i said... v=[2,3,4,3,5,2,3,5,2,3,4,2,1].'; % <- note: COLumn VECtor % so, reshape your MxN mat into a col vec... % note: this will accumulate start-end-points as well... us |