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

11 views (last 30 days)
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?
Ryan Livingston
Ryan Livingston on 1 Aug 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?

Sign in to comment.

Answers (0)


Find more on MATLAB Coder in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!