MATLAB App Designer: drawnow() is extremely slow

조회 수: 13 (최근 30일)
Sam Nadjari
Sam Nadjari 2019년 11월 21일
댓글: Adam Danz 2019년 11월 24일
I'm trying to update an image window every few milliseconds in MATLAB's app designer, but the drawnow() function is working very slowly. The same code is working much more quickly outside of the app designer environment. I read this in a separate thread:
Appdesigner (or specifically UIFigure) employs a HTML/Javascript layer which is less efficient than the standard matlab figure.
And I think this may be the root of my problem. Is there a workaround? Any other way to quickly update an image window?
Thanks

채택된 답변

Adam Danz
Adam Danz 2019년 11월 21일
drawnow() updates all existing graphics. The more graphics that exist, the more updating.
You could try setting the limit rate so that graphics are refreshed less frequently: drawnow limitrate
It's not clear why graphics need to be repeatedly updated but in some contexts, animating your data is a lot faster and cleaner with one of the animation methods such as animatedline.
  댓글 수: 6
Sam Nadjari
Sam Nadjari 2019년 11월 24일
drawnow limitrate works great for my purposes. It plots every few frames acquired without significantly slowing down the program. I will also give refreshdata() a try next time I get in the lab. Thanks so much for your help.
Adam Danz
Adam Danz 2019년 11월 24일
Good! If setting the limitrate in drawnow works I wouldn't bother trying the refreshdata method because you'll have to do some restructuring of your code and with frame rates of up to 1000fps, I doubt it would be sufficient.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by