MATLAB: Set the Ticks only on the X and Y axis

figure axesticks

How can I set the Ticks only on the X and Y axis as shown in the following image:

Best Answer

Set the axis box to 'off'.
Example
x = 0:20;
y = sin(x*pi/9);
figure(1)
plot(x, y);
grid
ha = gca;
ha.Box = 'off';
See if that does what you want to do.
See the documentation for Axes Properties (link) for details.