How can I obtain the total number of lines that can be run in a MATLAB file in MATLAB 7.14 (R2012a)?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I use the MATLAB Profiler to calculate the code coverage of the executed code.
I can use the following command and parse the data in the 'stats' structure to see which lines actually ran during execution. However, in order to calculate the coverage, I need to know how many lines of code could actually run in each function. I see this data in the MATLAB Profiler GUI as "Code lines (lines that can run)", but this information is not part of the stats structure.
Is there any way of obtaining this data either in the profiler or through another tool?
stats = profile('info')
Akzeptierte Antwort
MathWorks Support Team
am 11 Jun. 2012
The ability to return the number of lines that can be run using the MATLAB Profiler is not available in MATLAB.
To work around this issue you may use the file 'countlines.m' that is provided with the solution to count the number of lines in a MATLAB file.
countlines(<filename>)
The following calling syntax may be used to count the total number of lines of code in all of the MATLAB code files in the current working directory:
countlines('all')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!