help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: deleting columns in array with zeros


From: Rick T
Subject: Re: deleting columns in array with zeros
Date: Wed, 21 Mar 2012 12:08:22 -1000

thanks

On Wed, Mar 21, 2012 at 11:19 AM, Ben Abbott <address@hidden> wrote:

On Mar 21, 2012, at 5:12 PM, Rick T wrote:

> Greetings
>
> I have an array that starts of with zeros and continues into other numbers
> I would like to delete the columns in the array that start off with zero but keep the other numbers
>
> example of a column array below:
>
>     0 0 0 0 0 2 4 6 8 0 1 2
>
> Answer of column array would like like
>
>     2 4 6 8 0 1 2
>
> I'm using octave 3.4.2
> Thanks


       x = [0 0 0 0 0 2 4 6 8 0 1 2];
       n = find (x > 0, 1);
       x = x(n:end);

Ben




--
--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]