coder.extrinsic('applycform'); not support for code generation ? how to use instead of applycform
Show older comments
coder.extrinsic('applycform'); not support for code generation ?
Answers (1)
Walter Roberson
on 15 Mar 2018
Edited: Walter Roberson
on 15 Mar 2018
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 Comments
Sina Alighanbari
on 14 Oct 2018
Hi, I have a question about coder.extrinsic. I am using MATLAB R2013b for a special purpose. The solver that I am using used to work with this version of MATLAB but currently it is not working and I got this error:
"The function 'fdgmres' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation."
Although my simulink and codes are working with R2015b and R2017a (and even with R2013b in the past)without any problem. Does anyone have any idea?
Walter Roberson
on 14 Oct 2018
That routine does not appear to be supplied by Mathworks. It is possibly from https://archive.siam.org/books/kelley/fr16/matlabcode.php
Sina Alighanbari
on 19 Oct 2018
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
on 19 Oct 2018
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.
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!