Change the x-axes levels with a list of specific numbers in matlab -


i have following:
p = [2;3; 4; 6; 8;11;16;23;32; 45;64;91;128;181;256;362] = [4.00;3.66; 3.500; 3.50; 3.37; 3.27; 3.18; 3.13;3.09;3.04; 3.00;2.97;2.94;2.90;2.89;2.87]; down = [1.50; 2.00;2.00;2.16;2.25;2.27;2.37;2.43;2.50;2.55;2.57;2.61;2.64;2.67;2.68;2.70]; fill([p;flipud(p)],[up;flipud(down)],'--b')

this draw me x-coordinate: 0,50,100,150,200,250...400 want x-coordinate labels p values=(2,3,4,6,8,11,16,23,32,45,64,91,128,181,256,362)
please help.

i think length of xticklabel , xtick must match.

see following code sample:

x = 2:64; y = sin(x/10);  plot(x, y);  xticklabel = {'2' '3' '4' '6' '8' '11' '16' '23' '32' '45' '64'};  ax = gca; ax.xtick = linspace(x(1), x(end), length(xticklabel)); ax.xticklabel = xticklabel; 

enter image description here

as geekcristiano mentioned,

the above sample requires matlab r2014b , above.

for versions before matlab r2014b use following example:

x = 2:64; y = sin(x/10);  plot(x, y);  xticklabel = {'2' '3' '4' '6' '8' '11' '16' '23' '32' '45' '64'};  ax = gca; set(ax, 'xtick', linspace(x(1), x(end), length(xticklabel))); set(ax, 'xticklabel', xticklabel); 

Comments