i am facing an error -Error while evaluating TimerFcn for timer 'timer-1' Double inputs must have integer values in the range of ASSUMEDTYPE.,data is not showing continously..:(

i am getting data from teensy3.2 to matlab gui and there is a acquire option for data acquire option
v.timerObj = timer('Period', v.gSecPerScreenRefresh, 'ExecutionMode', 'fixedSpacing', 'timerFcn', {@getDataFromDeviceType});
output=Assuming device is named "COM7", use the Device Manager to show active ports.
Channels available: 8 Device ID register value: 146
ads Data: Recording 7 channels at 4000 Hz attached to port "COM7"
Error while evaluating TimerFcn for timer 'timer-1'
Double inputs must have integer values in the range of ASSUMEDTYPE.

10 comentarios

The routine name shown, getDataFromDeviceType, is one that I find only in association with ScopeMath for using Arduino as an oscilloscope. Is that the software you are running? We need to know which software you are using, and we need the complete error message including showing which line of code was executing.
I have a similar issue using ScopeMath. The entire error message reads:
channels available: 8 Device ID register value: 62
ads Data: Recording 5 channels at 250 Hz attached to port "/dev/cu.usbmodemfa131"
Error while evaluating TimerFcn for timer 'timer-1'
Double inputs must have integer values in the range of ASSUMEDTYPE.
Jonathan, are you using Arduino or Flock of Birds? The relevant code might be in either https://github.com/TaylorHanayik/StimSync/blob/master/osciMatlab/ScopeMath_Arduino.m or https://github.com/TaylorHanayik/StimSync/blob/master/osciMatlabFOB/ScopeMath_FOB.m . The error is almost certainly occurring in the serDecodeSub routines there, but the two routines differ quite a bit between the two cases so I would rather I only try to debug one of them.
It would be good if you could command
dbstop if error
and then run the code, and when the problem occurred, use dbstack to show exactly where you are executing. It would also help if you could show class(rawData), and the values of any variables mentioned on the line the problem occurs on.
I am using the arduino, and more specifically, the Arduino Due to communicate with the Texas Instruments ADS1299. Attached is the modified ScopeMath Code I am using to communicate with the ADS1299
The code did not get attached.
Also, the dbstack would help a fair bit.
Sorry about that. The code is attached now. I tried using the dbstop, but since this message isn't an "error message," the dbstop function is not detecting where this error is occurring.
"Double inputs must have integer values in the range of ASSUMEDTYPE." is an error message. But it might be caught by some code. Try
dbstop if caught error
and run.
I ran the "dbstop if caught error" command and found that it breaks here.
Caught-error breakpoint was hit in adsScopeMath>serDecodeSub at line 608. The error was:
Error using bitshift
Double inputs must have integer values in the range of ASSUMEDTYPE.
608 theSamples(i,samples) = bitshift(theSamples(i,samples),-8); %convert 32-bit to 24-bit
Hi Jonathan,
I spent a lot of time trying to solve the same problem, and this post helped a lot. So, I just want to complete the answer, as it can save someone else's time:
the line before the one where the code stops is the following:
theSamples(i,samples) = typecast(uint8([0 rawData(pos+(i*3)) rawData(pos-1+(i*3)) rawData(pos-2+(i*3)) ]), 'int32');
It forces the content of theSamples to be of type int32.
As in line 608, the data type is not assumed, the bitshift function treats your variable as an unsigned 64-bits integer (see bitshift)
The code, thus, breaks if the the content of theSamples is negative.
If you specify your variable is of type 'int32' while calling the bitshift, than the code runs
theSamples(i,samples) = bitshift(theSamples(i,samples),-8, 'int32');
best of luck,
Bel
Maria, I recommend that you post that as an Answer so you can be credited for it.

Iniciar sesión para comentar.

Respuestas (2)

I have faced with the similar error.
is there any way to use Try/Catch block to handle this kind of error in Timerfcn .
i mean this error happens in a vague situation for me (once in 10 times of run) so the question is is there any way to ignore it?
thanks in advance

1 comentario

Are you also using ScopedMath from Arduino? Or from Flock of Birds? Or do you have some other code that is invoking bitshift() ?
You could put in a try/catch block, such as replacing
theSamples(i,samples) = bitshift(theSamples(i,samples),-8);
with
try
shifted_output = bitshift(theSamples(i,samples),-8);
catch ME
shifted_output = something; %... what, exactly?
end
theSamples(i,samples) = shifted_output;
but if you were going to do that, then it seems to me it would make more sense put in some code to help debug the problem.

Iniciar sesión para comentar.

no,
in my code, I use many times,
cd(myNewAddress);
and by changing the current folder this error appears for me.
well, in the second folder i have some java code to parse some data from the OANDA database and during this interaction/ some times i got timerfcn error.
i use pause(.1) after any cd() and then some errors are gone but still some time(it is vague for me when !) i faced with the error.
the bad point is when it faces with error entire of the cycle of timer stop.

Categorías

Más información sobre External Language Interfaces en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 29 de Feb. de 2016

Respondida:

el 15 de Ag. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by