comparison scripts/plot/draw/stairs.m @ 19734:00e31f316a3a

Fix Matlab incompatibility of "ismatrix" (bug #42422). * data.cc (isvector): new tests * data.cc (isrow): documentation improved, new tests * data.cc (iscolumn): documentation improved, new tests * data.cc (ismatrix): is matrix now only checks the dimension due to Matlab compatibility, documentation improved, new tests * accumarray.m: use more appropriate function, than ismatrix * gradient.m: use more appropriate function, than ismatrix * num2str.m: use more appropriate functions, than ismatrix * ntsc2rgb.m: use more appropriate function, than ismatrix * condest.m: use more appropriate function, than ismatrix * expm.m: use more appropriate function, than ismatrix * onenormest.m: use more appropriate function, than ismatrix * isocolors.m: use more appropriate function, than ismatrix * isonormals.m: use more appropriate function, than ismatrix * isosurface.m: use more appropriate function, than ismatrix * __errcomm__.m: use more appropriate function, than ismatrix * __interp_cube__.m: use more appropriate function, than ismatrix * __marching_cube__.m: use more appropriate function, than ismatrix * __stem__.m: use more appropriate function, than ismatrix * stairs.m: use more appropriate function, than ismatrix * validsetargs.m: use more appropriate functions, than ismatrix * unique.m: use more appropriate functions, than ismatrix * bicg.m: additional tests for numerical value * bicgstab.m: additional tests for numerical value * cgs.m: additional tests for numerical value * gmres.m: additional tests for numerical value * qmr.m: additional tests for numerical value
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Thu, 12 Feb 2015 18:34:56 +0100
parents 4197fc428c7d
children
comparison
equal deleted inserted replaced
19733:2e9f17872f36 19734:00e31f316a3a
97 function [h, xs, ys] = __stairs__ (doplot, varargin) 97 function [h, xs, ys] = __stairs__ (doplot, varargin)
98 98
99 if (nargin == 2 || ischar (varargin{2})) 99 if (nargin == 2 || ischar (varargin{2}))
100 y = varargin{1}; 100 y = varargin{1};
101 varargin(1) = []; 101 varargin(1) = [];
102 if (! ismatrix (y) || ndims (y) > 2) 102 if (! isnumeric (y) || ndims (y) > 2)
103 error ("stairs: Y must be a numeric 2-D vector or matrix"); 103 error ("stairs: Y must be a numeric 2-D vector or matrix");
104 endif 104 endif
105 if (isvector (y)) 105 if (isvector (y))
106 y = y(:); 106 y = y(:);
107 endif 107 endif
108 x = 1:rows (y); 108 x = 1:rows (y);
109 else 109 else
110 x = varargin{1}; 110 x = varargin{1};
111 y = varargin{2}; 111 y = varargin{2};
112 varargin(1:2) = []; 112 varargin(1:2) = [];
113 if (! ismatrix (x) || ! ismatrix (y) || ndims (x) > 2 || ndims (y) > 2) 113 if (! isnumeric (x) || ! isnumeric (y) || ndims (x) > 2 || ndims (y) > 2)
114 error ("stairs: X and Y must be numeric 2-D vectors or matrices"); 114 error ("stairs: X and Y must be numeric 2-D vectors or matrices");
115 endif 115 endif
116 endif 116 endif
117 117
118 vec_x = isvector (x); 118 vec_x = isvector (x);
120 x = x(:); 120 x = x(:);
121 endif 121 endif
122 122
123 if (isvector (y)) 123 if (isvector (y))
124 y = y(:); 124 y = y(:);
125 elseif (ismatrix (y) && vec_x) 125 elseif (isnumeric (y) && vec_x)
126 x = repmat (x, [1, columns(y)]); 126 x = repmat (x, [1, columns(y)]);
127 endif 127 endif
128 128
129 if (! size_equal (x, y)) 129 if (! size_equal (x, y))
130 error ("stairs: X and Y sizes must match"); 130 error ("stairs: X and Y sizes must match");