home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / pnm / SImage / simagesc.m < prev   
Text File  |  2000-01-15  |  323b  |  15 lines

  1. #written by Stefan Mueller stm@fgan.de 1996
  2. function x = simagesc (x)
  3.  
  4.   [ high, wide ] = size (x);
  5.   maxval = max (max (x));
  6.   minval = min (min (x));
  7.   if (maxval == minval)
  8.     x = ones (high, wide);
  9.   else
  10.     x = fix ((x - minval) / (maxval - minval) * (length (colormap) - 1)) + 1;
  11.   endif
  12.   simage (x);
  13.  
  14. endfunction
  15.