0001 function tics = logticks(ax, lim, base) 0002 0003 if ~exist('lim','var') || isempty(lim) 0004 lim = get(gca, [ax, 'lim']); 0005 end 0006 0007 if ~exist('base','var') || isempty(base) 0008 base = 10; 0009 end 0010 0011 0012 if lim(2)-lim(1)>log(base) 0013 lim(1) = floorby(lim(1),log(base)); 0014 lim(2) = ceilby(lim(2),log(base)); 0015 ticks = lim(1):log(base):lim(2); 0016 else 0017 set(gca, [ax 'tickmode'], 'auto'); 0018 0019 ticks = get(gca,[ax 'tick']); 0020 end 0021 0022 0023 ticklab = foreach(@num2str_base, num2cell(exp(ticks)), [], base); 0024 0025 set(gca,[ax 'tick'], ticks,... 0026 [ax 'ticklabel'], ticklab); 0027