comparison scripts/image/loadimage.m @ 7313:7fd7abd37113

[project @ 2007-12-12 22:36:15 by jwe]
author jwe
date Wed, 12 Dec 2007 22:36:15 +0000
parents a1dbe9d80eee
children
comparison
equal deleted inserted replaced
7312:1ebbf0924217 7313:7fd7abd37113
42 error ("loadimage: unable to find image file"); 42 error ("loadimage: unable to find image file");
43 endif 43 endif
44 44
45 ## The file is assumed to have variables img and map, or X and map. 45 ## The file is assumed to have variables img and map, or X and map.
46 46
47 eval (sprintf ("load %s", file)); 47 vars = load (file);
48 48
49 if (exist ("img")) 49 if (isfield (vars, "img"))
50 img_retval = img; 50 img_retval = vars.img;
51 elseif (exist ("X")) 51 elseif (isfield (vars, "X"))
52 img_retval = X; 52 img_retval = vars.X;
53 else 53 else
54 error ("loadimage: invalid image file found"); 54 error ("loadimage: invalid image file found");
55 endif 55 endif
56 56
57 if (exist ("map")) 57 if (isfield (vars, "map"))
58 map_retval = map; 58 map_retval = vars.map;
59 else 59 else
60 error ("loadimage: invalid image file found"); 60 error ("loadimage: invalid image file found");
61 endif 61 endif
62 62
63 endfunction 63 endfunction