I have one more question which is - what must be the minimum configuration of my system if i am working on HL graphics in GUI ?
How to improve performance of GUIs ?
5 次查看(过去 30 天)
显示 更早的评论
Hello all , Its a general but crucial question . I want to ask that what are the factors which work on GUI performance and smoothness ? I want to develop a complicated and multi functional GUI , about what factors I should take care ? Thank you .
4 个评论
Walter Roberson
2016-1-11
编辑:Walter Roberson
2016-1-11
Every version of MATLAB that has supported graphics has supported "high level graphics", so the minimum configuration of your system would probably be something like MATLAB 2 on an Intel 286-class system with an early version of MS Windows. If you could still find such a system in working order. But the earliest release of MATLAB that you can still obtain is MATLAB 5, if you can find a copy of the book that was published that offered MATLAB on CDROM. If you cannot find that book, then the earliest MATLAB that you can still obtain from Mathworks is around MATLAB R13, so you will need at least 16 megabytes of RAM
If you meant to ask about the minimum configuration for the current release then see http://www.mathworks.com/support/sysreq/current_release/
采纳的回答
Walter Roberson
2016-1-8
Beyond that: if you use a handles structure, avoid storing large data in it, as that data would get copied around a lot. If you have large data, you can use getappdata() which at least gives you one level of subdivision on what needs to be copied. Also using handle objects saves on data being copied.
Avoid using global: it is one of the very slowest ways of transferring data.
Update graphics objects instead of building new ones. For example, instead of calling plot() in a loop, obtain the handles to the lines and update their XDATA, YDATA (and ZDATA) properties.
Be sure your graphics objects are getting deleted after you use them. On the other hand, if you have a GUI that is only present sometimes, it is more efficient to build it once and set it invisible when you do not need it, rather than deleting it and recreating it.
If you are developing non-trivial GUI code, then I recommend that you get in the habit of explicitly defining the parent of every graphics object you create. In many cases you can do that by passing an axes handle in as the first argument of a graphics call, but in other cases you may need to pass a 'Parent' name/value pair. For example instead of
figure;
plot(1:10, rand(1,10))
hold on
plot(1:10, randn(1,10))
hold off
instead code
f = figure();
ax = axes('Parent', f);
plot(ax, 1:10, rand(1,10));
hold(ax, 'on');
plot(ax, 1:10, randn(1,10));
hold(ax, 'off')
This is not so much a performance issue as it is a matter of sanity: without it you are almost certain to find that at some point the axes or figure you think you are drawing on is not the active axes or figure. And if you do any debugging, you are pretty likely to accidentally make the wrong axes or figure the current one in the process of moving windows around so that you can see the console or the source code. It is a bit of a nuisance to code it in every call, but it really makes a big difference for your sanity.
And then there is the fact that if you code this way then you seldom need to make a figure or axes "current" (you do not need gcf or gca if you are being careful to store and pass the information around.) When you make a figure active then that is one of the defined triggers for processing the graphics queue and rendering everything, which is something you want to avoid doing for performance reasons. Postpone, postpone, postpone -- no point in drawing something that might be changed by something else before the first thing is actually needed.
3 个评论
Stephen23
2016-1-8
Search this forum for alternatives to global. You will find lots of discussions on this topic. You might as well start with MATLAB's own documentation:
One of the most popular ways is to use guidata:
更多回答(1 个)
Yair Altman
2016-1-8
I believe that you will find the following useful: http://undocumentedmatlab.com/blog/some-performance-tuning-tips
It specifically addresses the issue of Matlab GUI performance
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!