Strange behavior of sum

dbateman at fladenmuller.org dbateman at fladenmuller.org
Tue Dec 9 14:22:05 CST 2008


On Tue, Dec 09, 2008 at 10:05:22PM +1930, Douglas Jim?nez wrote:
> ?Greetings!
> 
> First at all you have to forgive my bad english. Thank you.
> 
> After a period of correct behavior 'sum' begins to make some strange things.
> For example:
> 
>  octave:11> mu=rand(3,3)
> 
> mu =
> 
>  0.39068 0.20550 0.22666
> 
> 0.12383 0.95872 0.38691
> 
> 0.97295 0.18831 0.89087
> 
> octave:13> sum(mu(:,1))
> 
> octave:13>error: expecting integer index, found 0.390682
> 
> 
> octave:17> a=[1 2 3]
> 
> a =
> 
> 1 2 3
> 
> octave:19> sum(a)
> 
> ans =
> 
> 0 0 0
> 
> octave:21> a=[1;2;3]

<snip>

you're right that is weird.. I'd start with "which sum" and see if you 
haven't created a function with this wierd behavior that replaces the 
in-built version

D.


More information about the Bug-octave mailing list