time | Calls | line |
---|
| | 1 | function h = imagesc(varargin)
|
| | 2 | %IMAGESC Display image with scaled colors
|
| | 3 | % IMAGESC(...) is the same as IMAGE(...) except the data is scaled
|
| | 4 | % to use the full colormap.
|
| | 5 | %
|
| | 6 | % IMAGESC(...,CLIM) where CLIM = [CLOW CHIGH] can specify the
|
| | 7 | % scaling.
|
| | 8 | %
|
| | 9 | % See also IMSHOW, IMAGE, COLORBAR, IMREAD, IMWRITE.
|
| | 10 |
|
| | 11 | % Copyright 1984-2017 The MathWorks, Inc.
|
| | 12 |
|
| | 13 | import matlab.graphics.internal.*;
|
< 0.001 | 2 | 14 | clim = [];
|
< 0.001 | 2 | 15 | switch (nargin)
|
< 0.001 | 2 | 16 | case 0
|
| | 17 | hh = image('CDataMapping','scaled');
|
< 0.001 | 2 | 18 | case 1
|
| | 19 | hh = image(varargin{1},'CDataMapping','scaled');
|
< 0.001 | 2 | 20 | case 3
|
0.045 | 2 | 21 | hh = image(varargin{:},'CDataMapping','scaled');
|
| | 22 | otherwise
|
| | 23 |
|
| | 24 | % Determine if last input is clim
|
| | 25 | if isequal(size(varargin{end}),[1 2])
|
| | 26 | str = false(length(varargin),1);
|
| | 27 | for n=1:length(varargin)
|
| | 28 | str(n) = isCharOrString(varargin{n});
|
| | 29 | end
|
| | 30 | str = find(str);
|
| | 31 | if isempty(str) || (rem(length(varargin)-min(str),2)==0)
|
| | 32 | clim = varargin{end};
|
| | 33 | varargin(end) = []; % Remove last cell
|
| | 34 | else
|
| | 35 | clim = [];
|
| | 36 | end
|
| | 37 | else
|
| | 38 | clim = [];
|
| | 39 | end
|
| | 40 | hh = image(varargin{:},'CDataMapping','scaled');
|
< 0.001 | 2 | 41 | end
|
| | 42 |
|
| | 43 | % Get the parent Axes of the image
|
< 0.001 | 2 | 44 | cax = ancestor(hh,'axes');
|
| | 45 |
|
< 0.001 | 2 | 46 | if ~isempty(clim)
|
| | 47 | set(cax,'CLim',clim)
|
0.001 | 2 | 48 | elseif any(strcmpi(cax.NextPlot,{'replaceall','replace'}))
|
0.002 | 2 | 49 | set(cax,'CLimMode','auto')
|
< 0.001 | 2 | 50 | end
|
| | 51 |
|
< 0.001 | 2 | 52 | if nargout > 0
|
| | 53 | h = hh;
|
| | 54 | end
|
Other subfunctions in this file are not included in this listing.