Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Datatype problem with arduino and coder.ceval

1 visualización (últimos 30 días)
Marcell
Marcell el 30 de En. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hello, I'm writing a simulink device driver block for Arduino Due with the Matlab Function Approach as explained in the Simulink Device Driver guide. When I want to pass a double from the C++ code to the matlab function code with coder.ceval() I get a wrong number. Here is an example:
C++ function:
#include <Arduino.h>
extern "C" double dout_output()
{
return 50.5;
}
Matlab function in Simulink:
function x = example()
x = 0.0;
if strcmp(coder.target,'rtw'),
x = coder.ceval('dout_output');
end
When I run this code in external mode on an adruino due I don't get the 50.5 but a large number like 1113794816. Any sugestions?

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by