I met 'Function call Failed' error while I convert .m files to C with MATLAB coder.

3 visualizaciones (últimos 30 días)
Hello.
I'm trying to convert my .m files to C code with MATLAB coder. Many things should have been changed.
Anyway, look at following three lines. They are in a function that I made. They call 'rand' function.
PF_state_init(1,:) = 20*rand(1,N_particle);
PF_state_init(2,:) = 20*rand(1,N_particle);
PF_state_init(3,:) = 2*pi*rand(1,N_particle);
PF_state_init is defined as a global variable in the main script .m file.
There it is initialized. (PF_state_init = zeros(3,350);)
It is also defined as a global variables in the function.
I only call the script .m file when I execute the whole codes.
The problem is... when I tried to convert them to C code, MATLAB coder showed
'Function call failed'
I tried many things but I failed. N_particle is defined as a global variable and
it is also initialized (N_particle = 100;)
What on earth is the problem?
  2 comentarios
Walter Roberson
Walter Roberson el 1 de Ag. de 2015
Have you put in fprintf() around the calls to figure out exactly which line is failing?
Does the problem with failing calls go away in the function if you comment out the rand() calls?
Ryan Livingston
Ryan Livingston el 1 de Ag. de 2015
The "Function Call Failed" error message is usually a secondary message. If you click on the "Open Error Report" link, what is the first error and what line is it pointing to? Can you copy all of the errors from the report or post a screen shot of the report?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB Coder en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by