help-octave
[Top][All Lists]
Advanced

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

Re: foo_cs = foo{:} - feature or bug ? (octave-3.4.2); also, sizeof(foo{


From: Marco atzeri
Subject: Re: foo_cs = foo{:} - feature or bug ? (octave-3.4.2); also, sizeof(foo{:})
Date: Tue, 09 Aug 2011 09:53:06 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0

On 8/9/2011 7:27 AM, Sergei Steshenko wrote:

--- On Mon, 8/8/11, James Sherman Jr.<address@hidden>  wrote:

{cut]

Again trim your email !!!

octave:6>  sizeof(1 + 2)
ans =  8
"
the "1 + 2", which is an _expression_, is first converted (apparently) into
a _single_ double value, and the size of that double value is (apparently)
displayed.

So, the inconsistency, as I see it, is:

arithmetic expressions are _by_ _default_ converted into a _single_
memory location holding their value, and that memory location size in
bytes is dispalyed;
_opposed_ _to_ _that_
comma separated list is _not_ converted when 'sizeof' is called, but

function call requires arguments and the arguments are separated
by commas.

Immagine plot, it can take several arguments

 -- Function File:  plot (Y)
 -- Function File:  plot (X, Y)
 -- Function File:  plot (X, Y, PROPERTY, VALUE, ...)
 -- Function File:  plot (X, Y, FMT)
 -- Function File:  plot (H, ...)
 -- Function File: H = plot (...)

If a cs-list is transformed in a single object, how we
can differenziate the arguments ?

if X,Y is tranformed in Z
are we calling plot(Z) or plot (X,Y) ?

This is what happens with
 -- Built-in Function:  numel (A)
 -- Built-in Function:  numel (A, IDX1, IDX2, ...)

you are thinking numel(foo{:}) as it should
transform foo{:} in A and call numel(A)
but what is appening is

A=foo{1}
IDX1=foo{2}
IDX2=foo{3}
IDX3=foo{4}
...
numel (A, IDX1, IDX2, IDX3, ...)


Regards,
   Sergei.

Marco


reply via email to

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