Matlab:替换一个地块并维护其他地块

编程入门 行业动态 更新时间:2024-10-14 04:23:58
本文介绍了Matlab:替换一个地块并维护其他地块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个图,其中我绘制了一些分散点,然后绘制了轨迹.我想在不同的轨迹之间切换,方法是将它们绘制在与点相同的图形中,但又不创建新图形,即先擦除"第一个轨迹,然后绘制新轨迹.

I have a figure in which I plot some disperse points and then a trajectory. I want to switch between different trajectories by plotting them in the same figure as the points, but without creating new figures, i.e., "erasing" the first trajectory and then plotting the new one.

有没有办法做到这一点?

Is there a way of doing this?

推荐答案

也许这个小演示会有所帮助:

Perhaps this little demo will be helpful:

xy = rand(20,2); figure % Plot first iteration and output handles to each h = plot(xy(:,1),xy(:,2),'b.',xy(1:2,1),xy(1:2,2),'r-'); axis([0 1 0 1]) % Update second plot by setting the XData and YData properties of the handle for i = 2:size(xy,1)-1 set(h(2),{'XData','YData'},{xy(i:i+1,1),xy(i:i+1,2)}) drawnow pause(0.1); end

您应该阅读处理图形在Matlab和 get 和 set 函数.

You should read up on handle graphics in Matlab and the get and set functions.

更多推荐

Matlab:替换一个地块并维护其他地块

本文发布于:2023-05-29 03:37:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/335873.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地块   Matlab

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!