Mercurial > hg > octave-lojdl
changeset 2650:64aff25e8be3
[project @ 1997-01-31 16:16:53 by jwe]
author | jwe |
---|---|
date | Fri, 31 Jan 1997 16:17:01 +0000 |
parents | c3453130473b |
children | f2310b0b9653 |
files | scripts/ChangeLog scripts/image/default.img scripts/image/loadimage.m |
diffstat | 3 files changed, 30 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,14 @@ +Fri Jan 31 09:30:16 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * image/loadimage.m: Make it possible to load files with image + data named X or img. + + * image/default.img: Change name of image from X to img to match + what saveimage does now. + + * image/loadimage.m: Rename X to be img, to match what saveimage + does now. + Mon Jan 27 13:48:31 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * Version 2.0.2 released.
--- a/scripts/image/default.img +++ b/scripts/image/default.img @@ -66,7 +66,7 @@ 0.96825 0.96825 0.96825 0.98413 0.98413 0.98413 1.00000 1.00000 1.00000 -# name: img +# name: X # type: matrix # rows: 53 # columns: 40
--- a/scripts/image/loadimage.m +++ b/scripts/image/loadimage.m @@ -19,7 +19,7 @@ ## Load an image file. ## -## [X, map] = loadimage (img_file) loads an image and it's associated +## [img, map] = loadimage (img_file) loads an image and it's associated ## color map from file img_file. The image must be in stored in ## octave's image format. ## @@ -29,10 +29,10 @@ ## Created: July 1994 ## Adapted-By: jwe -function [X, map] = loadimage (filename) +function [img_retval, map_retval] = loadimage (filename) if (nargin != 1) - usage ("loadimage (filename)"); + usage ("[img, map] = loadimage (filename)"); elseif (! isstr (filename)) error ("loadimage: expecting filename as a string"); endif @@ -43,8 +43,22 @@ error ("loadimage: unable to find image file"); endif - ## XXX FIXME XXX -- file is assumed to have variables X and map. + ## The file is assumed to have variables img and map, or X and map. eval (['load ', file]); + if (exist ("img")) + img_retval = img; + elseif (exist ("X")) + img_retval = X; + else + error ("loadimage: invalid image file found"); + endif + + if (exist ("map")) + map_retval = map; + else + error ("loadimage: invalid image file found"); + endif + endfunction