[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with octave syntax please.
From: |
Jaroslav Hajek |
Subject: |
Re: Help with octave syntax please. |
Date: |
Mon, 30 Aug 2010 21:11:54 +0200 |
2010/8/30 John W. Eaton <address@hidden>:
> On 30-Aug-2010, Jordi Gutiérrez Hermoso wrote:
>
> | On 30 August 2010 11:11, Julien Martin <address@hidden> wrote:
> | > 1. I don't understand the bracket and the colon
> | > [0:ds:Smax]
> |
> | http://www.gnu.org/software/octave//doc/interpreter/Ranges.html#Ranges
>
> Perhaps that section should also explain that if a range expression
> appears inside square brackets it is converted to a matrix object,
> which will then expand all the elements of the range and (almost
> always) use up more memory.
It's not just square brackets; a range will be automatically converted
to a matrix in a lot of circumstances (e.g. element-wise multiply).
One can also list the cases where a range is *not* converted -
indexing by the range, range + scalar, range - scalar, range * scalar,
indexing the range by a single subscript,
and some useful builtins (dimension queries, sub2ind, sort, issorted, min/max).
regards
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz