开发者

Retrieving data from Matlab plot with limited axis

How can I retrieve data from Matlab plot window with limited axis? Code:

plot(ua,va,'rO');
axis([-320 320 -240 240]); box on;
lh=findall(gcf,'type','line');
xp=get(lh,'xdata');
yp=get(lh,'ydata');

If there is no data on the plot wi开发者_如何学运维ndow, xp and yp will give me data from the plot function (no window itself).


Suppose xp and yp are the x and y coordinates of all of the points. You can remove the points outside of [-320 320 -240 240] like this:

ii = xp < -320 | xp > 320 | yp < -240 | yp > 240;
xp(ii) = [];
yp(ii) = [];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜