From: us on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <i0cumb$pop$1(a)fred.mathworks.com>...
> "us " <us(a)neurol.unizh.ch> wrote in message
> > one of the solutions
> > - if(f) you own the stats tbx...
> >
> > % the data
> > v=[
> > 1 2 3 0 0 0
> > 0 3 0 5 0 0
> > ];
> > % the engine
> > tf=v~=0;
> > b=sum(tf,2);
> > a=sum(v,2);
> > r=a./b;
> > % the result
> > r
> > % r = 2 4
> >
> > us
>
> Do I misread you us? Why does one need the stats toolbox for this? Isn't your solution the same as:
>
> rows_mean = sum(A,2)./sum(logical(A),2)

ahhh... yes, matt...
typo(!): it should have read

- if(f) you do NOT own the stats tbx...

-and- your more simple version is the one to go with, of course...

sorry for confusion
us
From: Ulrik Nash on
Very nice! Thank you.

"Matt Fig" <spamanon(a)yahoo.com> wrote in message <i0cumb$pop$1(a)fred.mathworks.com>...
> "us " <us(a)neurol.unizh.ch> wrote in message
> > one of the solutions
> > - if(f) you own the stats tbx...
> >
> > % the data
> > v=[
> > 1 2 3 0 0 0
> > 0 3 0 5 0 0
> > ];
> > % the engine
> > tf=v~=0;
> > b=sum(tf,2);
> > a=sum(v,2);
> > r=a./b;
> > % the result
> > r
> > % r = 2 4
> >
> > us
>
> Do I misread you us? Why does one need the stats toolbox for this? Isn't your solution the same as:
>
> rows_mean = sum(A,2)./sum(logical(A),2)