From: Anthony Hopf on
us, very cool. If you want to get rid of any row that has 0's in it

m =

1 2 3
0 4 5
0 0 0
6 0 0

>> m(any(m==0,2),:)=[]

m =

1 2 3



"us " <us(a)neurol.unizh.ch> wrote in message <hs1qg9$psa$1(a)fred.mathworks.com>...
> "Rahul Singhal" <rsinghalomatic(a)gmail.com> wrote in message <hs1pti$hmk$1(a)fred.mathworks.com>...
> > Hi All,
> > I have a matrix containing 1's and 0's. I want to remove the rows that contain all 0's. Is there any matlab function that can do this.
> >
> > Can anybody help me in this.
> >
> > Thanks
> > Rahul Singhal
>
> one of the solutions
>
m=[
1 2 3
0 4 5
0 0 0
6 0 0
];
> m(all(m==0,2),:)=[]
> %{
> % m =
> 1 2 3
> 0 4 5
> 6 0 0
> %
>
> us