[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Constructing arrays
From: |
Jaroslav Hajek |
Subject: |
Re: Constructing arrays |
Date: |
Wed, 28 Jul 2010 11:11:11 +0200 |
On Tue, Jul 27, 2010 at 5:36 PM, John W. Eaton <address@hidden> wrote:
> On 26-Jul-2010, Andy Buckle wrote:
>
> | >a=floor(rand(1,16)*3)
> | a =
> |
> | 1 0 1 0 1 0 1 2 0 2 1 0 0 0 0 2
> |
> | >a(find(a==0))=[]
> | a =
> |
> | 1 1 1 1 2 2 1 2
>
> The call to find is not necessary here. You can use
>
> a(a == 0) = []
>
> to do the same thing.
>
FWIW, this is also slightly more efficient.
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Re: Constructing arrays, (continued)
- Re: Constructing arrays, dirac, 2010/07/26
- Re: Constructing arrays, Martin Helm, 2010/07/26
- RE: Constructing arrays, dirac, 2010/07/26
- Re: Constructing arrays, Andy Buckle, 2010/07/26
- Re: Constructing arrays, dirac, 2010/07/26
- Re: Constructing arrays, Andy Buckle, 2010/07/26
- Re: Constructing arrays, Martin Helm, 2010/07/26
- Re: Constructing arrays, dirac, 2010/07/27
- Re: Constructing arrays, John W. Eaton, 2010/07/27
- Re: Constructing arrays, dirac, 2010/07/28
- Re: Constructing arrays,
Jaroslav Hajek <=