How can I obtain the total number of lines that can be run in a MATLAB file in MATLAB 7.14 (R2012a)?
조회 수: 8 (최근 30일)
이전 댓글 표시
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')
채택된 답변
MathWorks Support Team
2012년 6월 11일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!