How can I determine if a script is being run by the codegen -test input parameter?
Show older comments
I would like to avoid running certain lines of code when runing a script that calls a generated mex file (codegen -test or coder.runTest).
I have a script that builds an entry point function "functionA"
codegen -config cfg functionA -args ARGS -test testScript
And I would like to avoid running certain lines of code within testScript only when running the test with codegen (i.e. in the codegen command or with coder.runTest). Is this possible, and if so how.
My first instinct was ~coder.target('MATLAB'), isdeployed, ismcc, however none of these return a true flag when running in test mode.
Accepted Answer
More Answers (1)
Noam Greenboim
on 7 May 2024
you can use the
coder.target
function to determine whether it's a mex or matlab.
Categories
Find more on MATLAB Coder 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!