Best practices to use Matlab assert
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi,
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.
Thanks,
Hari
댓글 수: 2
Stephen23
2021년 5월 31일
"In my project, i'm using 'assert' checks in many places in the code."
Then using ASSERT is the right thing to do: much better than code that fails badly without explanation.
"Does it has any overhead similar to traditional programming languages like C in debug mode."
No, the ASSERT itself is most likely going to require only a very small part of the total runtime.
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Function Creation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!