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 日

0 投票

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 ExchangeEnvironment and Settings についてさらに検索

製品

リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by