How to speed up GUI
古いコメントを表示
Hi people,
I have another question:
My gui has 4 axes elements, and an uitable. Now I am basically able to get the row index number and to use it in such a way I can put a marker (colored line) on the four plots contemporarily. The problem is now the speed. It takes very long to redraw all the four figures and the four lines eveytime i choose another element. how could I menage this?
I have a launch button, which during its own callback is reading an excel file, processing the data someway and generating the four vectors to plot. After that a refresh function is called, which plots the data in the right format, and puts the marker into a starting position. After that I call the refresh function evey time I choose a new value from the table, and this redraws the whole 4 graphics and the markers.
Which could be a better way to obtain this behaviour in less time?
採用された回答
その他の回答 (1 件)
Titus Edelhofer
2011 年 9 月 7 日
Usually you can speed up significantly by avoiding to redraw everything. When you plot the first time, save the handle:
handles.plot1 = plot(handles.axes1, ...);
guidata(hObject, handles);
When your callback wants to redraw, don't redraw everything but do something like
newX = ...;
newY = ...;
set(handles.plot1, 'xdata', newX, 'ydata', newY);
Titus
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!