What does determine the time to update plot?

조회 수: 1 (최근 30일)
sungwon min
sungwon min 2017년 7월 26일
편집: Jan 2017년 7월 27일
Hello everyone and thanks advance to read my questions.
I have make real time recording program. It has 32ch (it means 32 ea subplots) and each channel updated. I used bellow code to update my plot and check the time to update.
tic
set(DataLine, {'Ydata'}, num2cell(signal, 2)
% DataLine is 32 x 1 cell and signal 32 x 4000 matrix
toc
the code update same size matrix every time, but elapsed time is variable from about 2 to 7 ms Because I have make very strict recording program, I want the elapsed time will not variable. How can I update plot in very strict time?
And I have one more question! Different with above, I draw 20 number of plot which have 40 samples at each subplot (32 figure * 20 plot * 40 samples = 25,600) I think it will have short updating time than above (32 figure * 4000 samples = 128,000) because, It has less number of data, but when I update that by bellow, it need longer time!
set(DataLine(:,:), {'Ydata'}, num2cell(cell2mat(spike),2));
% spike 32 x 1 cell that each cell has 20 x 40 matrix
Is any body can help me? thanks!

채택된 답변

Jan
Jan 2017년 7월 26일
편집: Jan 2017년 7월 27일
Part 1: The update of the figures is triggered by drawnow or pause. As you have obeserved correctly, the times are varying and this is expected in Matlab. It depends on many different factors, e.g. other programs, the graphics board, network traffic, hard disk fragmentation, amount of free RAM, etc. Neither Matlab nor your operating system is designed for a fixed rate of processing.
Part 2: As you see the number of data is less important than the number of drawn objects. It is much more expensive to draw 2 lines with 1000 points, than 1 line with 2000 points.
The num2cell(cell2mat()) construct might waste time. See FEX: Cell2Vec - cell2mat seems to have problems with the pre-allocation.
  댓글 수: 1
sungwon min
sungwon min 2017년 7월 27일
Thank you very much! Everything what i wondered was clear! thanks your help!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 성능과 메모리에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!