help-octave
[Top][All Lists]
Advanced

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

Re: Help with octave syntax please.


From: John W. Eaton
Subject: Re: Help with octave syntax please.
Date: Mon, 30 Aug 2010 12:52:38 -0400

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.  For example:

  octave:1> x = 0:0.1:1;
  octave:2> y = [0:0.1:1];
  octave:3> whos
  Variables in the current scope:

    Attr Name        Size                     Bytes  Class
    ==== ====        ====                     =====  ===== 
         ans         1x30                        30  char
         x           1x11                        24  double
         y           1x11                        88  double

  Total is 52 elements using 142 bytes

  octave:4> typeinfo (x)
  ans = range
  octave:5> typeinfo (y)
  ans = matrix

jwe



reply via email to

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