Static analysis of .m files

5 次查看(过去 30 天)
Ashley Thorpe
Ashley Thorpe 2019-11-15
回答: Jatin 2024-9-19
I am used to working with static analysis tools which enforce the MISRA standard on c and c++ code.
But now we are creating a tool using matlab .m files, and I am trying to understand what static analysis checks we can set up.
I have already set up a unit test which performs the matlab checkcode (new mlint function) across all the source files to check for matlab code analyser issues and determine code complexity. This is good, but the matlab code analyser checks do not seem quite as stringent as the full MISRA checks
I have come across the Polyspace toolbox, but from initial research I assume this is only for analysing c/C++ generated code.
My question – is there any further static analysis that I can perform on the matlab .m source files to further check for and enforce the harshest MISRA rules?

回答(1 个)

Jatin
Jatin 2024-9-19
Hi Ashley,
You're correct that there isn't a specific static analysis tool for MATLAB files, and your understanding is right that the product PolySpace Code Prover and Bug Finder are used to analyze C/C++ codes. You're on the right track by using the MATLAB Code Analyzer and writing unit tests with the MATLAB Unit Testing Framework to maintain high code quality and enforce rigorous coding standards.
Additionally, consider using the MATLAB Profiler which is used to analyze the performance of your MATLAB code. It helps identify bottlenecks, optimize code execution time and improve the code quality of MATLAB files.
For more information on profiler, you can refer to the documentation here:
I hope this helps address your query.

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by