Performance of graphics (stand-alone)

I have created an application with a lot of graphics and it works flawlessly in the matlab environment. However, when i compile it and run it the performance is not good at all. It seems like it cannot update the screen as fequently as in the Matlab environment. I have for example a function that draws a line from a point selected by a first mouse click, after that a line is drawn from this start point to the position of the mouse. When I move the mouse in the matlab environment one end of the line is completely "stuck" to the pointer no matter how fast I move it. In the stand-alone version. It doesn't follow nearly as smoothly. Any idea how to fix it or is the performance in stand-alone applications that much worse in performance?

4 Comments

I'm not familiar with this issue, but it might help if you can post code snippets of how you achieve the drawing - this will help us narrow down the issue to specific MATLAB functions/toolboxes. Also, please specify the development/target platforms.
You can use the following function after creating an axes with the "motionfcn" set to "drawLine"... In Matlab environment it works pefectly, but as stand-alone it is very slow!
function drawLine
%--- Choose alternative (1-erase/redraw 2-update coordinates)
alt=1;
%--- Get current pointer position ---%
coords=get(gca,'CurrentPoint');
%--- Check if a line exist and get handle
h=findobj(gcf,'Type','Line');
if alt==1
delete(h)
plot([0 coords(1,1)],[0 coords(1,2)]);
else
if isempty(h)
plot([0 coords(1,1)],[0 coords(1,2)]);
else
set(h,'XData',[0 coords(1,1)],'YData',[0 coords(1,2)]);
end
end
You can also try to compile the example "window_motion_fcn". It gives the same result...
Please consider contacting Tech support (http://www.mathworks.com/matlabcentral/answers/2495-when-shall-i-contact-mathworks-technical-support-and-how) if you do not receive a reply from the user community.

Sign in to comment.

Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Asked:

on 19 Apr 2011

Community Treasure Hunt

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

Start Hunting!