MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Hello kity
on 9 Jan 2013

I plot something and Matlab auto chooses the axis step as 5, I want it 1.

how can i say that the step size should be 1.

I know you can use:

set(gca,'YTick',[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 etc]);

but this is just too long :)

*No products are associated with this question.*

Answer by Jonathan Sullivan
on 9 Jan 2013

Accepted answer

xbounds = xlim; set(gca,'XTick',xbounds(1):xbounds(2));

## 1 Comment

## Jan Simon

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/58334#comment_121643

A more compact form of the question:

Defining vectors and arrays is one of the absolutely fundamental basics in Matlab. Therefore the language is called "Mat(rix)lab". Reading the "Getting Started" chapters of the documentation explains the basic usage of Matlab exhaustively. Therefore reading them is strongly recommended, while a forum is not the right place learning this.