V_XTICKINT removes non-integer ticks from a plot XTICK=(AX) Usage: plot(...); % plot a graph v_xtickint; % remove any non-integer tick marks Inputs: ax axis to remove ticks from [current plot axis] Outputs: xtick list of remaining tick positions
0001 function xtick=v_xtickint(ax) 0002 %V_XTICKINT removes non-integer ticks from a plot XTICK=(AX) 0003 % 0004 % Usage: plot(...); % plot a graph 0005 % v_xtickint; % remove any non-integer tick marks 0006 % 0007 % Inputs: ax axis to remove ticks from [current plot axis] 0008 % 0009 % Outputs: xtick list of remaining tick positions 0010 % 0011 0012 % Copyright (C) Mike Brookes 2024 0013 % Version: $Id: v_xtickint.m $ 0014 % 0015 % VOICEBOX is a MATLAB toolbox for speech processing. 0016 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0017 % 0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0019 % This program is free software; you can redistribute it and/or modify 0020 % it under the terms of the GNU General Public License as published by 0021 % the Free Software Foundation; either version 2 of the License, or 0022 % (at your option) any later version. 0023 % 0024 % This program is distributed in the hope that it will be useful, 0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0027 % GNU General Public License for more details. 0028 % 0029 % You can obtain a copy of the GNU General Public License from 0030 % http://www.gnu.org/copyleft/gpl.html or by writing to 0031 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0033 if nargin<1 || isempty(ax) 0034 ax=gca; % use current axes 0035 end 0036 xtick=get(ax,'xtick'); 0037 set(ax,'xtick',xtick(round(xtick)==xtick));