MATLAB Answers

Best practices to use Matlab assert

조회 수: 4(최근 30일)
Hari Krishna Nalla
Hari Krishna Nalla 2021년 5월 31일
댓글: Bruno Luong 2021년 6월 1일
In my project, i'm using 'assert' checks in many places in the code.
I would like to understand how it impacts he runtime? Does it has any overhead similar to traditional programming languages like C in debug mode.
  댓글 수: 2
Bruno Luong
Bruno Luong 2021년 6월 1일
Other alternative to assert is arguments block

댓글을 달려면 로그인하십시오.


Bruno Luong
Bruno Luong 2021년 5월 31일
No C debug mode slows every statement down. ASSERT costs the overhead of checking whatever you instruct MATLAB to check.
It matter or not depends on the percentage of that overhead wrt to the rest of the code.




Community Treasure Hunt

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

Start Hunting!

Translated by