From: Edwin on 27 May 2010 10:50 hello everybody, if I have the next matrix M=[ 2007 8 13 4.6 2007 8 14 4.5 2007 8 14 5 2007 8 15 0 2007 8 16 5.1 2007 8 17 0 2007 8 18 0 2007 8 19 4.50 2007 8 19 4.5 2007 8 19 4.4 2007 8 19 4.4 ] anyone have idea of a way to count the repeated dates (columns 1:3) but depending on column 4. I mean if column 4 is zero then we must say that there is zero occurrence of that date. for example M=[ 2007 8 13 1 2007 8 14 2 2007 8 15 0 2007 8 16 1 2007 8 17 0 2007 8 18 0 2007 8 19 4 ] thanks in advance.
From: us on 27 May 2010 11:03 "Edwin " <onest30(a)gmail.com> wrote in message <htm0rd$d51$1(a)fred.mathworks.com>... > hello everybody, > if I have the next matrix > M=[ > 2007 8 13 4.6 > 2007 8 14 4.5 > 2007 8 14 5 > 2007 8 15 0 > 2007 8 16 5.1 > 2007 8 17 0 > 2007 8 18 0 > 2007 8 19 4.50 > 2007 8 19 4.5 > 2007 8 19 4.4 > 2007 8 19 4.4 > ] > anyone have idea of a way to count the repeated dates (columns 1:3) but depending on column 4. I mean if column 4 is zero then we must say that there is zero occurrence of that date. > for example > M=[ > 2007 8 13 1 > 2007 8 14 2 > 2007 8 15 0 > 2007 8 16 1 > 2007 8 17 0 > 2007 8 18 0 > 2007 8 19 4 > ] > > thanks in advance. one of the many solutions m=M; [mu,mx,my]=unique(m(:,1:3),'rows'); n=histc(my,1:max(my)); n(m(mx,4)==0)=0; r=[mu,n] %{ % r = 2007 8 13 1 2007 8 14 2 2007 8 15 0 2007 8 16 1 2007 8 17 0 2007 8 18 0 2007 8 19 4 %} us
From: Edwin on 10 Jun 2010 06:40 thanks a lot
|
Pages: 1 Prev: Pose tracking in an image/video - mocap Next: Need help desperately: lsqlin |