フィルターのクリア

In this code, how can I add a time function for how long it takes to draw the graph?

1 回表示 (過去 30 日間)
Laura
Laura 2023 年 4 月 4 日
コメント済み: Walter Roberson 2023 年 4 月 4 日

回答 (2 件)

Walter Roberson
Walter Roberson 2023 年 4 月 4 日
You could add tic before the plot() and drawnow(); toc after the title()...
But really you cannot measure it. Once the graph objects have been finalized they are sent to an independent graphics thread for rendering, and there is no way to measure the time taken in the rendering.
And you have to be specific about graphics execution time: do you include the time required for the graphics card to execute? Do you include the time for the graphics card to send the pixels to the display? Do you include the time for the display to draw?

Joe Vinciguerra
Joe Vinciguerra 2023 年 4 月 4 日
tic
plot(t,v)
toc
  1 件のコメント
Walter Roberson
Walter Roberson 2023 年 4 月 4 日
graphics are not sent to rendering until the graphics queue is flushed:
  • pause()
  • drawnow()
  • waitfor() /uiwait()
  • figure() or uifigure()
  • return to command line because program ends or because of debugging or keyboard()
So in the above, the graphics would not have been sent to rendering at all until after the toc()

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by