home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / GRAPHICS.DI$ / IMAGESC.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  519 b   |  25 lines

  1. function h = imagesc(x,y,a)
  2. %IMAGESC Scale data and display as image.
  3. %    IMAGESC(...) is the same as IMAGE(...) except the data is scaled
  4. %    to use the full colormap.
  5. %    See also IMAGE.
  6.  
  7. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  8.  
  9. m = size(colormap,1);
  10. if nargin == 1
  11.     a = x;
  12. end
  13. amin = min(min(a));
  14. amax = max(max(a));
  15. idx = min(m,round((m-1)*(a-amin)/(amax-amin))+1);
  16. if nargin == 1
  17.     hh = image(idx);
  18. else
  19.     hh = image(x,y,idx);
  20. end
  21. set(hh,'UserData',[amin amax]);
  22. if nargout > 0
  23.     h = hh;
  24. end
  25.