How to Fix Error "The extrinsic function 'toc' is not available for standalone code generation."
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Kuber Dwivedi
il 30 Mag 2022
Commentato: Kuber Dwivedi
il 8 Giu 2022
The extrinsic function 'toc' 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 'toc' or by ensuring that its outputs are unused.
Find below code
function y = fcn
%#codegen
persistent temp;
coder.extrinsic('tic')
if isempty(temp)
tic;
temp = 0;
end
coder.extrinsic('toc')
temp = toc;
y = temp;
Risposta accettata
Ishwara Sharma
il 8 Giu 2022
The Code generation capabilities for Tic/Toc were added in R2019a. So you can use tic and toc without 'coder.extrinsic' in latest version of the MATLAB and that will resolve the code generation error.
https://www.mathworks.com/help/matlab/ref/tic.html#mw_9bdbc46b-87b1-492b-b0e6-caeb3e886db4
function y = fcn %#codegen
persistent temp;
if isempty(temp)
tic;
temp = 0;
end
temp = toc;
y = temp;
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!