changeset 5962:2289cafef60d

[project @ 2006-08-24 16:23:12 by jwe]
author jwe
date Thu, 24 Aug 2006 16:23:12 +0000
parents 1c61d6a2c9e6
children b3478d7a0486
files scripts/ChangeLog scripts/image/saveimage.m
diffstat 2 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-24  John W. Eaton  <jwe@octave.org>
+
+	* image/saveimage.m: Use logical indexing instead of
+	indices computed by calling find on the logical index.
+
 2006-08-24  Søren Hauberg  <soren@hauberg.org>
 
 	* miscellaneous/bincoeff.m: Use logical indexing instead of
--- a/scripts/image/saveimage.m
+++ b/scripts/image/saveimage.m
@@ -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"))