help-octave
[Top][All Lists]
Advanced

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

Re: numel(foo{:}) - feature or bug ?


From: Sergei Steshenko
Subject: Re: numel(foo{:}) - feature or bug ?
Date: Fri, 5 Aug 2011 23:38:40 -0700 (PDT)


--- On Fri, 8/5/11, PhilipNienhuis <address@hidden> wrote:

> From: PhilipNienhuis <address@hidden>
> Subject: Re: numel(foo{:}) - feature or bug ?
> To: address@hidden
> Date: Friday, August 5, 2011, 10:41 AM
> 
> Sergei Steshenko-2 wrote:
> > 
> > --- On Fri, 8/5/11, Martin.Hepperle &lt;address@hidden&gt;
> wrote:
> > 
> >> From: Martin.Hepperle &lt;address@hidden&gt;
> >> Subject: Re: numel(foo{:}) - feature or bug ?
> >> To: address@hidden
> >> Date: Friday, August 5, 2011, 5:13 AM
> >> Hmmm...this is what I get under
> >> Windows ("official" MINGW binary):
> >> 
> >> octave-3.2.4.exe:53> foo
> >> foo =
> >> 
> >> {
> >>   [1,1] = a
> >>   [1,2] = ab
> >>   [1,3] = abc
> >>   [1,4] =
> >> 
> >>       1    2    3 
> >>   4
> >>       5    6    7 
> >>   8
> >>      
> >> 9   10   11   12
> >> 
> >> }
> >> 
> >> octave-3.2.4.exe:54> numel(foo)
> >> ans =  4
> >> octave-3.2.4.exe:55> numel(foo{:})
> >> error: Invalid call to numel.  Correct usage is:
> > 
> > <snip>
> > 
> > Please note that:
> > 
> > 1) you are using version 3.2.4 while I am using 3.4.2,
> i.e. mine is later;
> > 2) I run Linux while you Windows.
> > 
> > Anyway, I think 2) is irrelevant is this case, i.e. I
> think it's a
> > regression in 3.4.2 rather than Linux <->
> Windows issue.
> > 
> 
> On Windows, using Tatsuro's 3.4.2. binary, it goes like
> this:
> 
> 
> GNU Octave, version 3.4.2
> Copyright (C) 2011 John W. Eaton and others.
> This is free software; see the source code for copying
> conditions.
> There is ABSOLUTELY NO WARRANTY; not even for
> MERCHANTABILITY or
> FITNESS FOR A PARTICULAR PURPOSE.  For details, type
> `warranty'.
> :
> Octave was configured for "i686-pc-mingw32".
> :
> <snip>
> 
> octave.exe:1> foo = {'a'}
> foo =
> {
>   [1,1] = a
> }
> octave.exe:2> foo{2} = 'bc'
> foo =
> {
>   [1,1] = a
>   [1,2] = bc
> }
> octave.exe:3> foo{3} = 'bcd'
> foo =
> {
>   [1,1] = a
>   [1,2] = bc
>   [1,3] = bcd
> }
> octave.exe:4> foo{4} = rand(4,4)
> foo =
> {
>   [1,1] = a
>   [1,2] = bc
>   [1,3] = bcd
>   [1,4] =
> 
>  
>    0.946214   0.483896   0.964641   0.845847
>  
>    0.066998   0.897528   0.972649   0.099501
>  
>    0.423324   0.309595   0.964653   0.515342
>  
>    0.401630   0.106199   0.283850   0.831350
> 
> }
> octave.exe:5> numel (foo)
> ans =  4           
>                
>    ## What I expected
> octave.exe:6> numel(foo{:})
> ans =  96           
>              
>    ## Hmmm.....
> octave.exe:7>
> 
> Go figure....
> 
> Philip
> 
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/numel-foo-feature-or-bug-tp3720972p3721796.html
> Sent from the Octave - General mailing list archive at
> Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
> 

Thanks for the update.

I rechecked the thread, and if I am not mistaken, in my case it is:

"
octave:5> foo{4} = [1 2 3 4; 5 6 7 8; 9 10 11 12]
foo =
{
  [1,1] = a
  [1,2] = ab
  [1,3] = abc
  [1,4] =

      1    2    3    4
      5    6    7    8
      9   10   11   12

}
octave:6> numel(foo{:})
ans =  72 
",

while in your case it is:

"
octave.exe:6> numel(foo{:})
ans =  96          ## Hmmm.....
".

I.e. for the same input data we have different results (72 <-> 96).

Again, if I'm not mistaken in all these observations, could you please
reopen the http://savannah.gnu.org/bugs/?33954 bug ?

Thanks,
  Sergei.


reply via email to

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