How can I generate c code for inbuilt MATLABfunction using codegen ?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Avithal
il 24 Lug 2014
Commentato: Ryan Livingston
il 28 Lug 2014
codegen worked fine in simple functions I wrote. I have to generate c code forestimateGeometricTransform
1)Tried with all inputs defined | *
codegen estimateGeometricTransform -args {M1,M2,ch} -report -config:lib
*Error recieved* * _:The extrinsic function 'projective2d' is not available for standalone code generation. It must be eliminated for stand-alone code to be generated. It could not be eliminated because its outputs appear to influence the calling function. Fix this error by not using 'projective2d' or by ensuring that its outputs are unused.
Error in ==> estimateGeometricTransform Line: 174 Column: 17 Code generation failed: Open error report. Error using codegen (line 144)_ *
2)So tried to bypass code generation of projective2d by addinf a line in the inbuilt function
coder.extrinsic ('affine2d','projective2d');
*Error recieved* same as above
3)tried to eliminate line of code where ' * projective2d' * appears
%tform = projective2d(tmatrix);
Error recieved Output argument 'tform' is not assigned on some execution paths.
Error in ==> estimateGeometricTransform Line: 1 Column: 11 Code generation failed: Open error report. Error using codegen (line 144)
0 Commenti
Risposta accettata
Andy Sonnenburg
il 25 Lug 2014
New versions of MATLAB Coder should support
projective2d
Adding
coder.extrinsic('projective2d')
will not help when compiling with
-config:lib
where the extrinsic function has a side effect - usually via an output variable. Put another way, coder.extrinsic will only help when compiling with -config:lib if the the use of the function is "dead". See coder.extrinsic for more information.
The commenting out of the line that assigns tform results in an error because tform can no longer be proven to be definitely assigned before first used. For example, changing
tform = ...
foo(tform)
to
% tform = ...
foo(tform)
will result in an error because tform will not definitely be assigned before use (and in this example, is never assigned before use).
2 Commenti
Ryan Livingston
il 28 Lug 2014
In R2014a, projective2d should be supported for code generation. Search for it here:
When something is "supported for code generation" there is generally no need to use coder.extrinsc. You should be able to just remove the:
coder.extrinsic('projective2d')
from your code.
Then you will be able to call projective2d in your code and generate code that uses its output. So:
tform = projective2d(tmatrix);
should be perfectly allowed without the coder.extrinsic call for projective2d.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Generating Code in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!