Mercurial > hg > mauch-mirex-2010
diff _misc/figures/.svn/text-base/uimagesc.m.svn-base @ 8:b5b38998ef3b
added all that other stuff
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:54:25 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/_misc/figures/.svn/text-base/uimagesc.m.svn-base Fri Apr 11 15:54:25 2014 +0100 @@ -0,0 +1,57 @@ +function h = uimagesc(varargin) +%UIMAGESC Display scaled image with uneven axis. +% UIMAGESC(...) is the same as UIMAGE(...) except the data is scaled +% to use the full colormap. See UIMAGE for details. +% +% Note: UIMAGESC is based on Matlab's original IMAGESC, Revision 5.11.4.5. +% UIMAGESC simply calls UIMAGE with a scaled colormap. +% +% F. Moisy - adapted from TMW +% Revision: 1.01, Date: 2006/06/13. +% +% See also IMAGE, IMAGESC, UIMAGE. + +% History: +% 2006/06/12: v1.00, first version. + +clim = []; +switch (nargin), + case 0, + hh = uimage('CDataMapping','scaled'); + case 1, + hh = uimage(varargin{1},'CDataMapping','scaled'); + case 3, + hh = uimage(varargin{:},'CDataMapping','scaled'); + otherwise, + + % Determine if last input is clim + if isequal(size(varargin{end}),[1 2]) + str = false(length(varargin),1); + for n=1:length(varargin) + str(n) = ischar(varargin{n}); + end + str = find(str); + if isempty(str) || (rem(length(varargin)-min(str),2)==0), + clim = varargin{end}; + varargin(end) = []; % Remove last cell + else + clim = []; + end + else + clim = []; + end + hh = uimage(varargin{:},'CDataMapping','scaled'); +end + +% Get the parent Axes of the image +cax = ancestor(hh,'axes'); + +if ~isempty(clim), + set(cax,'CLim',clim) +elseif ~ishold(cax), + set(cax,'CLimMode','auto') +end + +if nargout > 0 + h = hh; +end