Why does the Profiler show substantially different results for the same code?

I want to use the profiler "bar map" at the top to show students how to use and analyze code using the profiler in MATLAB R2020a
-A single click only shows non-built in function in the bar map.
-A double click shows built in and non-built in functions sometimes, and sometimes only non-built in functions.
Why do I see this behavior, and how can I make it more consistent?

 채택된 답변

MathWorks Support Team
MathWorks Support Team 2020년 4월 10일
편집: MathWorks Support Team 2020년 5월 19일
When you profile the code from the profiler window, it captures all the code that runs there. This can be different code from what is running when using the MATLAB Command Window.
If you click too quickly, you could restart profiling while MATLAB was still working on cleaning up the workspace. I was able to reproduce this behavior - showing extra information - when rapidly clicking the 'Run and Time' profiling button.
As a workaround, single clicking should show consistent profiling results. Alternatively, hitting "Enter" from the text input where the script name is should also avoid double execution.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by