coder.extr​insic('app​lycform'); not support for code generation ? how to use instead of applycform

조회 수: 6 (최근 30일)
coder.extrinsic('applycform'); not support for code generation ?

답변 (1개)

Walter Roberson
Walter Roberson 2018년 3월 15일
편집: Walter Roberson 2018년 3월 15일
You are misusing coder.extrinsic
"coder.extrinsic declares extrinsic functions. During simulation, the code generator produces code for the call to an extrinsic function, but does not produce the function's internal code. Therefore, simulation can run only on platforms where MATLAB software is installed. During standalone code generation, MATLAB attempts to determine whether the extrinsic function affects the output of the function in which it is called — for example by returning mxArrays to an output variable. Provided that there is no change to the output, MATLAB proceeds with code generation, but excludes the extrinsic function from the generated code. Otherwise, compilation errors occur."
if isdeployed()
transformed_cform = coder.ceval('my_applycform', cform_to_transform)
else
transformed_cform = applycform(cform_to_transform);
end
where my_applycform is C code you have written to replace applycform . This would not be code generated by MATLAB: this would be work-alike code that you wrote yourself.
For emphasis: there is no way to get MATLAB to generate code for applycform, so you need to write replacement code. (Or you could apply for a job at Mathworks to work through all of the steps needed on the Mathworks side to be able to generate code for applycform.)
  댓글 수: 4
Sina Alighanbari
Sina Alighanbari 2018년 10월 19일
Thanks for your reply. I have another question. If we use matlab R2017a and generate C code for a matlab file, is it possible to use that C code in matlab R2013b with coder.ceval instead of the original matlab file?
Walter Roberson
Walter Roberson 2018년 10월 19일
Probably. There is a risk that the r2017a generated code might be targeted to a later release of C than was supported in R2013b, but I think you can control the target language version.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by