# MATLAB: Get the values of the axis of a plot

axis; plot;

I have created a plot and I want to know if there is a command to get the value of the x axis of the plot because I want to draw an horizontal line just as long as the x axis
thanks

XL = get(gca, 'XLim');
plot(XL, [1 1]*val)
XT = get(gca, 'XTick');