Hello all. I´m using Matlab2013.
I have a single-channel signal stored in a matrix, which i can process with standard commands. I used GLIDE to build a simple GUI to freely transform the signal with a slider... all transformations work so far.
The idea is to increase or decrease the decimation factor with the slider... which should be simple, right?.. Well, not quite.
If i execute this instructions:
NEWSIGNAL = decimate(ORIGINAL,10000);
TimeVector = decimate(TimeVector,10000);
It works and i downsample te signal by a factor of 10000.
However.. if i use a variable instead of a number in the second parameter, such as:
NEWSIGNAL = decimate(ORIGINAL,SLIDERVALUE);
TimeVector = decimate(TimeVector,SLIDERVALUE);
The following error message pops every time i change the slider value.
Error using cheby1 (line 59)
The cutoff frequencies must be within the interval of (0,1).
Error in decimate (line 122)
[b,a] = cheby1(nfilt, rip, .8/r);
Error in Lab3>sumarN_Callback (line 217)
NEWSIGNAL = decimate(ORIGINAL,r);
I suspected the variable type of SLIDERVALUE was not being an integer, but indeed it is... its actually an int16.
Why is the decimate() function working when i use a static integer as decimation factor, but failing when i use a variable as factor ??
I tried to pass a variable manually set to 10000 and it works fine. But it will not work with the int16() i get from the slider... What kind of cast type variable is the function expecting?
I tried doing SLIDERVALUE+0 and SLIDERVALUE/1 as arguments to force a more standard type as parameter... and nothing.
Pedro Universidad el Bosque