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: Ben Abbott
Subject: Re: deleting columns in array with zeros
Date: Wed, 21 Mar 2012 17:19:42 -0400

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]