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
On Sun, 18 Jun 2006 19:20:16 +0200, 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 You have a variable called 'sum' in your workspace. Try renaming it to something else in your script or clear it before doing the sum. Dan
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