Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从具有有限轴的 Matlab 绘图窗口中检索数据?代码:
plot(ua,va,'rO'); axis([-320 320 -240 240]); box on; lh=findall(gcf,'type','line'); xp=get(lh,'xdata'); yp=get(lh,'ydata');
如果绘图窗口上没有数据,xp 和 yp 会给我绘图函数的数据(没有窗口本身)。
假设xp和yp是所有点的 x 和 y 坐标。您可以像这样删除点之外的点[-320 320 -240 240]:
xp
yp
[-320 320 -240 240]
ii = xp < -320 | xp > 320 | yp < -240 | yp > 240; xp(ii) = []; yp(ii) = [];