# HG changeset patch # User jwe # Date 1156436592 0 # Node ID 2289cafef60d6083756fbda21f5d5c9737ea12cb # Parent 1c61d6a2c9e6dd90acc036c0cafbc1e9f1e7f3dc [project @ 2006-08-24 16:23:12 by jwe] diff -r 1c61d6a2c9e6 -r 2289cafef60d scripts/ChangeLog --- a/scripts/ChangeLog Thu Aug 24 15:57:08 2006 +0000 +++ b/scripts/ChangeLog Thu Aug 24 16:23:12 2006 +0000 @@ -1,3 +1,8 @@ +2006-08-24 John W. Eaton + + * image/saveimage.m: Use logical indexing instead of + indices computed by calling find on the logical index. + 2006-08-24 Søren Hauberg * miscellaneous/bincoeff.m: Use logical indexing instead of diff -r 1c61d6a2c9e6 -r 2289cafef60d scripts/image/saveimage.m --- a/scripts/image/saveimage.m Thu Aug 24 15:57:08 2006 +0000 +++ b/scripts/image/saveimage.m Thu Aug 24 16:23:12 2006 +0000 @@ -125,11 +125,8 @@ map = reshape (map, map_sz, 1); - idx = find (map > 1); - map (idx) = ones (size (idx)); - - idx = find (map < 0); - map (idx) = zeros (size (idx)); + map (map > 1) = 1; + map (map < 0) = 0; map = round (255 * map); @@ -143,11 +140,8 @@ img_sz = img_nr * img_nc; img = reshape (img, img_sz, 1); - idx = find (img > map_nr); - img (idx) = ones (size (idx)) * map_nr; - - idx = find (img <= 0); - img (idx) = ones (size (idx)); + img (img > map_nr) = map_nr; + img (img <= 0) = 1; if (strcmp (img_form, "ppm"))