Azzera filtri
Azzera filtri

Code generation

4 visualizzazioni (ultimi 30 giorni)
galen
galen il 24 Giu 2011
I'm trying to use code generation to have all calculations done in C then passed to Matlab. I'm currently having problems using coder.ceval. It is telling me 'Too many output arguments'.
function y = callfoo %#codegen
y = int32(0);
y = coder.ceval('func', int32(5), int32(5));
end
#include stdio.h
#include stdlib.h
#include "func.h"
int32_T func(real_T in1, real_T in2)
{
return in1-in2; }

Risposte (2)

Kaustubha Govind
Kaustubha Govind il 24 Giu 2011
Perhaps you are attempting to run this code in MATLAB? coder.ceval only applies during code generation. You may need to modify your code to something like:
function y = callfoo %#codegen
y = int32(0);
if isempty(coder.target)
% Executing in MATLAB, call MATLAB equivalent of func
y = 5 - 5;
else
y = coder.ceval('func', 5, 5); %in1 and in2 are double
end
end

John Elliott
John Elliott il 24 Giu 2011
In addition to the explicit problem that Kaustubha identified, you have declared you C function to accept real_T arguments, but you are passing int32_T arguments, so you either need to change the C code, or do what Kaustubha did (don't cast the inputs to int32).

Categorie

Scopri di più su MATLAB Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by