Draw utilizing GUI handles
1 回表示 (過去 30 日間)
古いコメントを表示
I have developed a code for drawing dynamically changing neighbor nodes to a moving one. The problem is that when I draw them, and they get changed, it adds the new nodes (yellow color) to the old ones and does not clean the old drawn ones. I am using drawnow and plot and tried lots of variations.
I would much appreciate any help on this. The code is below:
valAnchors=get(handles.hshowAnchors,'Value');
if valAnchors
%hold on;
for j=1:numel(T_R_neighbour(:,1))
node=T_R_neighbour(j,1);
n_X=net(2,node);
n_Y=net(3,node);
sendPointAnch(j) = line('XData',1, 'YData',1, 'EraseMode','normal', ...
'Color','y', 'Marker','.', 'MarkerSize',30);
set(sendPointAnch(j), 'XData',n_X, 'YData',n_Y) %# update point location
end
end
0 件のコメント
回答 (1 件)
Walter Roberson
2012 年 7 月 28 日
MATLAB has some graphic primitives that always always add to the current scene, without erasing anything that is already there. These primitives include line(), patch(), image(), and a few others. (However, plot() is not one of the primitives.)
If you want to erase a graphics object created by a graphics primitive, then delete() it, or cla() to clear the axes.
Instead of creating new lines, you should consider using set() to change the position or color or other attributes of existing lines.
0 件のコメント
参考
カテゴリ
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!