The MLCOVR package provides XML-formatted output that is consistent with the Cobertura Java coverage tool. It uses the MATLAB profile tool along with custom scripts to evaluate lines covered, branches covered, branch types and complexity. It works on a directory and its subdirectories, collecting information as packages for display.
MLCOVR is part of the FAST software. FAST: A Framework for Agile Software Development Copyright (c) 2008-2009 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.
MLCOVR subversion repository is maintained at
I think this is a great piece of work. So far the only working way to add a coverage report for our automated test cases.
While I'm at it: I needed another fix in coveragerptxml.m (line 120) and coveragerpthtml.m (line 162):
Methods.type is no longer a string, but an enumeration type. It can simply be cast to char:
I think there is a problem when using mlcovr with R2013b (and maybe others).
getmfilelist gives an error on line 170 because the Methods returned by getcallinfo don't include the field calllines. The simple fix is to remove this line, since the callines isn't used anywhere.
A second possibility to fix the issue is to change line 84 to
Methods = getcallinfo(mFiles(n).filename,'-v7.8',code);
which will bring the callines field back, but "This option is only for a multi-release conversion of the output is will be removed in a future version." (internal documentation of getcallinfo on the '-v7.8' option)
Updated to provide an option for HTML formatted code coverage output.