繁体   English   中英

如何得到MATLAB中某个数字的最小x、最大x、最小y、最大y?

[英]How to get the min x, max x, min y and max y of a certain figure in MATLAB?

我想设计一个function,它可以根据用户输入的参数('UpperLeft','UpperRight','LowerLeft','LowerRight')在图形的右上角添加文字。 我是这样实现的:如果我想在左上角添加文字,我先得到图中坐标轴的min x和max y,然后用text(min_x, max_y, 'text')绘制它。 但是我不知道function可以得到最小x和最大y。 如果还有其他方法可以实现我想要的 function 呢?

x = 3*sin(linspace(0,10,100));
figure
plot(x)
xl = xlim
yl = ylim
% upper left (ish), you'll want to position the text a little down and to
% the right depending on the dimensions of the plot
text(xl(1), yl(2), 'text')

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM