Main Content
Verify MEX Functions at the Command Line
If you have a test file that calls your original MATLAB® function,
you can use coder.runTest
to verify
the MEX function at the command line. coder.runTest
runs
the test file replacing calls to the original MATLAB function
with calls to the generated MEX function. For example, here is a call
to coder.runTest
for the test file myfunction_test
and
the function myfunction
coder.runTest('myfunction_test', 'myfunction')
If errors occur during the run with coder.runTest
,
call stack information is available for debugging.
Alternatively, you can use the codegen
-test
option.
codegen myfunction -test 'myfunction_test'
The test file can be a MATLAB function, script, or class-based unit test.