0001 function p = PlotHVLines(positions,direction,varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 if nargin < 1,
0022 error('Incorrect number of parameters (type ''help <a href="matlab:help PlotHVLines">PlotHVLines</a>'' for details).');
0023 end
0024 if nargin < 2,
0025 direction = 'v';
0026 else
0027 direction = lower(direction);
0028 end
0029 if min(size(positions)) > 2,
0030 error('List of abscissae/ordinates is not a vector (type ''help <a href="matlab:help PlotHVLines">PlotHVLines</a>'' for details).');
0031 else
0032 positions = positions(:);
0033 end
0034
0035 if ~isastring(direction,'h','v'),
0036 varargin = {direction,varargin{:}};
0037 direction = 'v';
0038 end
0039
0040 hold on;
0041 if strcmp(direction,'v'),
0042 yLim = ylim;
0043 for i = 1:size(positions,1),
0044 plot([positions(i,1) positions(i,1)],yLim,varargin{:});
0045 end
0046 else
0047 xLim = xlim;
0048 for i = 1:size(positions,1),
0049 plot(xLim,[positions(i,1) positions(i,1)],varargin{:});
0050 end
0051 end