Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i get the upper (and lower) limits of an axis in MATLAB?

Tags:

matlab

How do I find the minimum and maximum of the axis in a MATLAB plot?

like image 846
Brian Avatar asked Oct 19 '10 04:10

Brian


1 Answers

Here's how you can do it for the current axes (i.e. 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

Each variable above will be a 1-by-2 array containing the minimum and maximum values for the respective axis. You can check the documentation on axes properties for more information.

like image 73
gnovice Avatar answered Oct 02 '22 12:10

gnovice