PDA

View Full Version : the # of signinficant digits in Matlab plot


Useful nucleus
May12-10, 08:50 PM
When I plot a function using MATLAB where the y-axis, for example, has values of : 1.8, 1.9, 2.0 , 2.1

Matlab ignores the number of siginficant digits when printing the value of 2.0, so it prints out:

1.8, 1.9, 2, 2.1

It there a way to change this?

Thank you in advance

MikeyW
May13-10, 01:48 AM
XTickLabel is a property of the graph which you can set, and you can set it as strings so MATLAB doesn't automatically round the numbers off.

For example:


>> set(gca,'XTickLabel',{'1.8';'1.9';'2.0';'2.1';'2.2 '})


The hassle is you have to type all the other ones as well, but it works. There might be a shortcut.

Useful nucleus
May13-10, 04:04 AM
Thank you very much! It worked!