如何在MATLAB中获得轴的上限(和下限)?

Bri*_*ian 7 matlab

如何在MATLAB图中找到轴的最小值和最大值?

gno*_*ice 17

以下是如何为当前轴(即gca)执行此操作:

xLimits = get(gca,'XLim');  %# Get the range of the x axis
yLimits = get(gca,'YLim');  %# Get the range of the y axis
zLimits = get(gca,'ZLim');  %# Get the range of the z axis
Run Code Online (Sandbox Code Playgroud)

上面的每个变量都是一个1乘2的数组,包含相应轴的最小值和最大值.您可以查看轴属性的文档以获取更多信息.