How can I force a custom framerate over 20 frames per second from "drawnow limitrate"

40 views (last 30 days)
Hello,
I am generating a realtime GUI plot and using drawnow to update the figure in real time. I want the frame rate to be 30, not 20 as limited by drawnow limitrate. Without limitrate applied, the drawnow function slows down with time and the graphics are no longer real time (this is important as the GUI must represent real time data from a serial input).
How can I have drawnow run at a custom framerate instead of 20 as forced by limitrate?
Here is the section of code where drawnow is implemented (towards the bottom):
while(j<50000)
% Import IMU Quaternion and convert to rotation matrix
gca;
idn = fscanf(s);
char(idn);
IMUdata = textscan(idn,'%f %f %f %f %f','Delimiter',',');
quat1 = IMUdata{1, 2};
quat2 = IMUdata{1, 3};
quat3 = IMUdata{1, 4};
quat4 = IMUdata{1, 5};
quat = [quat1, quat2, quat3, quat4];
rotm = qGetR(quat);
%%Drawing blue box
dcm = rotm;
P = [A;B;F;H;G;C;A;D;E;H;F;D;E;C;G;B];
%rotate about Center, but this is not good way to rotate about a point
for i=1:length(P)
P(i,:)=P(i,:)-Center;
end
P = P*dcm;
for i=1:length(P)
P(i,:)=P(i,:)+Center;
end
plot3(handles.axes2,P(:,1),P(:,2),P(:,3),'Color','b');hold on;
hold off;
axis([-2 2 -2 2 -2 2]);
grid on;
view([1,1,1]) ;
xlabel('X');
ylabel('Y');
zlabel('Z');
drawnow limitrate;
j=j+1;
cla(handles.axes2)
end;
Thank you,
Kevin

Answers (1)

Faiz Gouri
Faiz Gouri on 16 Aug 2017
The ability to modify the default rate of the DRAWNOW LIMITRATE command is not available in MATLAB and there is currently no workaround available to modify it.

Community Treasure Hunt

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

Start Hunting!

Translated by