Can't use 'sum function'

noise = [1,2,0,3,0,0,0,4];
a = sum(noise)
when I execute this I get:
??? Subscript indices must either be real positive integers or logicals.
Error in ==> test3>haps at 22
a = sum(noise)
Error in ==> test3 at 5
C = haps(2);
>>
what is wrong??
JOhs

Johs32 wrote:
> noise = [1,2,0,3,0,0,0,4];
> a = sum(noise)
>
> when I execute this I get:
>
> ??? Subscript indices must either be real positive integers or logicals.
>
> Error in ==> test3>haps at 22
> a = sum(noise)
>
> Error in ==> test3 at 5
> C = haps(2);
>
>
> what is wrong??
>
> JOhs
>
>
at the place where this happens, set a breakpoint, start the program and
once the debugger stops there, at the commandline type "which sum" and
report the findings.
i suspect you defined a local SUM function which shadows the one defined
in matlab...
michael

Michael Wild wrote:
>
>
> Johs32 wrote:
>> noise = [1,2,0,3,0,0,0,4];
>> a = sum(noise)
>>
>> when I execute this I get:
>>
>> ??? Subscript indices must either be real positive integers or
> logicals.
>>
>> Error in ==> test3>haps at 22
>> a = sum(noise)
>>
>> Error in ==> test3 at 5
>> C = haps(2);
>>
>>
>> what is wrong??
>>
>> JOhs
>>
>>
>
>
> at the place where this happens, set a breakpoint, start the
> program and
> once the debugger stops there, at the commandline type "which sum"
> and
> report the findings.
> i suspect you defined a local SUM function which shadows the one
> defined
> in matlab...
>
> michael
>
Actually, this should be a variable named sum.
Note the error message. It refers to the line
>> a = sum(noise)
and then talks about subscript indices.
Never name things names like sum.
John