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

조회 수: 9 (최근 30일)
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
Walter Roberson
Walter Roberson 2015년 8월 1일
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 2015년 8월 1일
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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by