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-2018 The MathWorks, Inc.
|
| | 12 |
|
| | 13 | import matlab.graphics.internal.*;
|
| | 14 |
|
| | 15 |
|
< 0.001 | 2 | 16 | clim = [];
|
< 0.001 | 2 | 17 | if nargin == 0
|
| | 18 | % Really no args. Just add CDataMapping.
|
| | 19 | hh = image('CDataMapping', 'scaled');
|
< 0.001 | 2 | 20 | else
|
< 0.001 | 2 | 21 | checkArgs = varargin;
|
| | 22 | % Check to see if the first argument is a handle.
|
< 0.001 | 2 | 23 | if nargin >= 1 && isa(varargin{1}, 'matlab.graphics.Graphics')
|
| | 24 | % Remove this arg for the sake of examining inputs.
|
| | 25 | checkArgs(1) = [];
|
< 0.001 | 2 | 26 | end
|
< 0.001 | 2 | 27 | nCheckArgs = length(checkArgs);
|
< 0.001 | 2 | 28 | if nCheckArgs > 1
|
| | 29 | % Determine if last input is clim
|
< 0.001 | 2 | 30 | if isequal(size(checkArgs{end}),[1 2])
|
| | 31 | % Last input is 1x2 vector. Might be clims.
|
| | 32 |
|
| | 33 | % Look for param/value pairs.
|
| | 34 | str = false(length(checkArgs),1);
|
| | 35 | for n=1:length(checkArgs)
|
| | 36 | str(n) = isCharOrString(checkArgs{n});
|
| | 37 | end
|
| | 38 | str = find(str);
|
| | 39 | if ~(isempty(str) && nCheckArgs == 3)
|
| | 40 | % We are not in the imagesc(x, y, C) case.
|
| | 41 | if isempty(str) || (rem(length(checkArgs)-min(str),2)==0)
|
| | 42 | % There were no param / value pairs, or there were and
|
| | 43 | % the last arg was not part of one.
|
| | 44 | % Remove clims from original arg list.
|
| | 45 | clim = varargin{end};
|
| | 46 | varargin(end) = []; % Remove last cell
|
| | 47 | end
|
| | 48 | end
|
< 0.001 | 2 | 49 | end
|
< 0.001 | 2 | 50 | end
|
| | 51 |
|
0.128 | 2 | 52 | hh = image(varargin{:}, 'CDataMapping', 'scaled');
|
< 0.001 | 2 | 53 | end
|
| | 54 |
|
| | 55 | % Get the parent Axes of the image
|
< 0.001 | 2 | 56 | cax = ancestor(hh,'axes');
|
| | 57 |
|
< 0.001 | 2 | 58 | if ~isempty(clim)
|
| | 59 | set(cax,'CLim',clim)
|
< 0.001 | 2 | 60 | elseif any(strcmpi(cax.NextPlot,{'replaceall','replace'}))
|
< 0.001 | 2 | 61 | set(cax,'CLimMode','auto')
|
< 0.001 | 2 | 62 | end
|
| | 63 |
|
< 0.001 | 2 | 64 | if nargout > 0
|
| | 65 | h = hh;
|
< 0.001 | 2 | 66 | end
|
Other subfunctions in this file are not included in this listing.