Improving speed of line plotting

조회 수: 8 (최근 30일)
Thomas Marullo
Thomas Marullo 2017년 6월 23일
편집: dpb 2017년 6월 24일
Is there any way to improve the speed of plotting 1000 lines at once? I am drawing an animation of a wireframe building using some external data which takes 0.05 seconds to acquire. In the following function, X and Y are set up to have coordinate pairs for 1000 lines, X and Y are type 2x1000 double. The issue is that I'm getting like 3fps. Was hoping to get something like 10-15fps. I tried doing a scatter plot of just the coordinates to see how that would work and scatter is much faster, getting like 25fps but then I just have coordinate points. Need to have the connecting lines to show the building.
Just FYI, I also tried using 'plot' instead of 'line' and I get the same response.
while (true)
clf;
% Acquire some new coordinates (takes 0.05 seconds from data acquisition)
X = %some new data%;
Y = %some new data%;
line (X,Y,'LineWidth',[1.0],'Color',[0 0 1]);
pause(0.001);
end
  댓글 수: 1
dpb
dpb 2017년 6월 23일
편집: dpb 2017년 6월 24일
Yes, you can do better than calling line over and over...read the section <Animation> in the doc for starters. Probably just updating the '[X|Y]Data' properties will be what you'll want for your purposes, but be good to look over the alternatives discussed there.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by