Knowing what order of magnitude a number is can be really helpful when performing analysis. I find this especially useful when setting my color-scale using caxis.

To find the order of magnitude of a number, denoted as O(10^{n}) of some number A in matlab, use:

n=floor( log10(A));

A few examples:

A=.00314; n=-3; 10^{n}=.001;

A=.95; n=-1; 10^{n}=.1;

A=6; n=0; 10^{n}=1;

A=12456789; n=7; 10^{n}=10000000;

And here's an example of when I might use this. Say I don't know How big the values in the matrix C1C2 are going to be, but they could vary orders of magnitude between experiments.

Cmax=10^(ceil( log10( max(C1C2(:)) ))); imagesc(Xs,Ys,C1C2);caxis([0 Cmax]) colormap(flipud(gray)); cbfreeze(colorbar('location','EastOutside',... 'YTick',... [0,Cmax/2,Cmax],... 'YTickLabel',... {0,Cmax/2,Cmax })); freezeColors;

For more on the specific options i used in making this plot, see my post about Making Pretty Matlab Plots