Prev: MCRInstaller.exe
Next: AR, MA, ARMA
From: John D'Errico on 20 Dec 2007 12:40 beginner1.mat(a)hotmail.com wrote in message <37c5867e-e5fc-4b04- 884c-7dda096dc833(a)s8g2000prg.googlegroups.com>... > I am using an m-flie I made within another m-file and am coming up > with a 'Warning' that I don't quite understand: > > >In mfile1 at 25 > >In mfile2 at 60 > >Warning: Integer operands are required for colon operator when used as index > > Does anybody understand as to why it would point to the line below > since there is no colon operator in that line. > > > time=1:length(data).*(1/fs); > a=1; > b=step; > for i=1:floor(time) > x = data(a:b); a is an integer (1). What is b? We see above that b = step. What is step? My guess is that step is not an integer. > a = a+step; > b = b+step; > Y = fft(x,512); > PY= (Y.*conj(Y))/512;%% WARNING IS POINTING TO THIS LINE Have you edited the file, but not saved it yet, and then tried to use it? John
From: beginner1.mat on 20 Dec 2007 22:06 On Dec 20, 9:40 am, "John D'Errico" <woodch...(a)rochester.rr.com> wrote: > beginner1....(a)hotmail.com wrote in message <37c5867e-e5fc-4b04- > > 884c-7dda096dc...(a)s8g2000prg.googlegroups.com>... > > > > > > > I am using an m-flie I made within another m-file and am coming up > > with a 'Warning' that I don't quite understand: > > > >In mfile1 at 25 > > >In mfile2 at 60 > > >Warning: Integer operands are required for colon operator when used as > index > > > Does anybody understand as to why it would point to the line below > > since there is no colon operator in that line. > > > time=1:length(data).*(1/fs); > > a=1; > > b=step; > > for i=1:floor(time) > > x = data(a:b); > > a is an integer (1). > > What is b? > > We see above that b = step. > > What is step? My guess is that step is not > an integer. > > > a = a+step; > > b = b+step; > > Y = fft(x,512); > > PY= (Y.*conj(Y))/512;%% WARNING IS POINTING TO THIS LINE > > Have you edited the file, but not saved it yet, > and then tried to use it? > > John- Hide quoted text - > > - Show quoted text - b is actually the number of steps (or number of points...similar to the sampling rate). In this particular case, b = 10. I have edited the file, but it is saved. The file actually runs, but the warning persists.
From: Roger Stafford on 20 Dec 2007 22:24 beginner1.mat(a)hotmail.com wrote in message <37c5867e- e5fc-4b04-884c-7dda096dc833(a)s8g2000prg.googlegroups.com>... > I am using an m-flie I made within another m-file and am coming up > with a 'Warning' that I don't quite understand: > > >In mfile1 at 25 > >In mfile2 at 60 > >Warning: Integer operands are required for colon operator when used as index > > Does anybody understand as to why it would point to the line below > since there is no colon operator in that line. > > > time=1:length(data).*(1/fs); > a=1; > b=step; > for i=1:floor(time) > x = data(a:b); > a = a+step; > b = b+step; > Y = fft(x,512); > PY= (Y.*conj(Y))/512;%% WARNING IS POINTING TO THIS LINE > PY_half = PY(1:(512/2)+1); > freq = fs*(0:(512/2))/512; > PY_all(1,i)= PY_half(1) > end -------- Maybe matlab is compaining about the fact that the quantity after the colon in your 'for' range is not a single integer but an array of them. That is, 'time' is an array and therefore so is 'floor(time)'. That doesn't look like valid matlab coding to me. Roger Stafford
From: beginner1.mat on 21 Dec 2007 06:24 On Dec 20, 7:24 pm, "Roger Stafford" <ellieandrogerxy...(a)mindspring.com.invalid> wrote: > beginner1....(a)hotmail.com wrote in message <37c5867e- > > e5fc-4b04-884c-7dda096dc...(a)s8g2000prg.googlegroups.com>... > > > > > I am using an m-flie I made within another m-file and am coming up > > with a 'Warning' that I don't quite understand: > > > >In mfile1 at 25 > > >In mfile2 at 60 > > >Warning: Integer operands are required for colon operator when used as > index > > > Does anybody understand as to why it would point to the line below > > since there is no colon operator in that line. > > > time=1:length(data).*(1/fs); > > a=1; > > b=step; > > for i=1:floor(time) > > x = data(a:b); > > a = a+step; > > b = b+step; > > Y = fft(x,512); > > PY= (Y.*conj(Y))/512;%% WARNING IS POINTING TO THIS LINE > > PY_half = PY(1:(512/2)+1); > > freq = fs*(0:(512/2))/512; > > PY_all(1,i)= PY_half(1) > > end > > -------- > Maybe matlab is compaining about the fact that the quantity after the colon > in your 'for' range is not a single integer but an array of them. That is, 'time' > is an array and therefore so is 'floor(time)'. That doesn't look like valid > matlab coding to me. > > Roger Stafford- Hide quoted text - > > - Show quoted text - floor(time) =51 I also noticed simple functions are incorrect like 2+2 does not equal 4...but I restarted my computer and things were fine...does this sound like a virus?
From: Randy Poe on 21 Dec 2007 10:42
On Dec 21, 6:24 am, beginner1....(a)hotmail.com wrote: > On Dec 20, 7:24 pm, "Roger Stafford" > > > > <ellieandrogerxy...(a)mindspring.com.invalid> wrote: > > beginner1....(a)hotmail.com wrote in message <37c5867e- > > > e5fc-4b04-884c-7dda096dc...(a)s8g2000prg.googlegroups.com>... > > > > I am using an m-flie I made within another m-file and am coming up > > > with a 'Warning' that I don't quite understand: > > > > >In mfile1 at 25 > > > >In mfile2 at 60 > > > >Warning: Integer operands are required for colon operator when used as > > index > > > > Does anybody understand as to why it would point to the line below > > > since there is no colon operator in that line. > > > > time=1:length(data).*(1/fs); > > > a=1; > > > b=step; > > > for i=1:floor(time) > > > x = data(a:b); > > > a = a+step; > > > b = b+step; > > > Y = fft(x,512); > > > PY= (Y.*conj(Y))/512;%% WARNING IS POINTING TO THIS LINE > > > PY_half = PY(1:(512/2)+1); > > > freq = fs*(0:(512/2))/512; > > > PY_all(1,i)= PY_half(1) > > > end > > > -------- > > Maybe matlab is compaining about the fact that the quantity after the colon > > in your 'for' range is not a single integer but an array of them. That is, 'time' > > is an array and therefore so is 'floor(time)'. That doesn't look like valid > > matlab coding to me. > > > Roger Stafford- Hide quoted text - > > > - Show quoted text - > > floor(time) =51 That doesn't make sense. What are fs and length(data)? Apparently due to precedence of operations, this time=1:length(data).*(1/fs); evaluates as time=1: (length(data).*(1/fs)) ; which means time = [1, 2, ... something] But I can't think of any way it could evaluate to a single value whose floor is 51. - Randy |