Using a single figure frame for chasePlot used inside a loop
1 次查看(过去 30 天)
显示 更早的评论
I have a while loop inside of which I have to use a plot and a chasePlot function.
The problem is, it comes up with a new window figure each time the loop runs. I somehow want a single frame which can be updated rather than each time making a new window and figure for it.
Anybody knows how to prevent a new figure in each loop so that one figure is there and that keeps on updating.
0 个评论
采纳的回答
Greg Dionne
2017-11-14
If you have a handle to the axes you are using you can pass it to the 'Parent' property of the chasePlot when you construct it.
Something like:
hAxes = axes
chasePlot(scenario, 'Parent', hAxes)
3 个评论
Greg Dionne
2017-11-15
You'll probably want to do something like this (ultimately)
% set working figure to figure 1 (creating if it doesn't exist)
figure(1);
% get current axes (creating if it doesn't exist)
hAxes = gca;
% pass it to the chase plot.
chasePlot(passingCar,'Parent',hAxes)
If you call axes() you may end up creating a new one each time and just rendering it over the previous axes.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Formatting and Annotation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!