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

6 Ansichten (letzte 30 Tage)
coder.extrinsic('applycform'); not support for code generation ?

Antworten (1)

Walter Roberson
Walter Roberson am 15 Mär. 2018
Bearbeitet: Walter Roberson am 15 Mär. 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 Kommentare
Sina Alighanbari
Sina Alighanbari am 19 Okt. 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
Walter Roberson am 19 Okt. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by