comparison scripts/image/imwrite.m @ 18538:fcd87f68af4f

Deprecate nfields and replace with numfields. * NEWS: Announce deprecation of nfields and addition of new function numfields. * container.txi: Add numfields to the manual. * oct-map.cc (octave_map::cat): Change %!tests to use numfields. * ov-struct.cc (Fnumfields): Function renamed from nfields. * scripts/deprecated/nfields.m: Add m-file which warns about nfields deprecation. * scripts/deprecated/module.mk: Add nfields.m to build system. * fieldnames.m: Change seealso link to point to numfields. * __isequal__.m: Use numfields to simplify code. * imwrite.m: Replace 'isempty (fieldnames (fmt))' with 'numfields (fmt) > 0' for clarity. * imageIO.m: Replace 'isempty (fieldnames (fmt))' with 'numfields (fmt) > 0' for clarity. * importdata.m: Use numfields to simplify code. * assert.m: Use numfields to simplify code.
author Rik <rik@octave.org>
date Sun, 02 Mar 2014 12:56:11 -0800
parents bfbe5dcc9943
children 7b60d0d9f0f2
comparison
equal deleted inserted replaced
18537:f958e8cd6348 18538:fcd87f68af4f
98 [filename, ext] = imwrite_filename (varargin{2:end}); 98 [filename, ext] = imwrite_filename (varargin{2:end});
99 99
100 fmt = imformats (ext); 100 fmt = imformats (ext);
101 ## When there is no match, fmt will be a 1x1 structure with 101 ## When there is no match, fmt will be a 1x1 structure with
102 ## no fields, so we can't just use `isempty (fmt)'. 102 ## no fields, so we can't just use `isempty (fmt)'.
103 if (isempty (fieldnames (fmt))) 103 if (numfields (fmt) > 0)
104 if (isempty (ext)) 104 if (isempty (ext))
105 error ("imwrite: no extension found for %s to identify the image format", 105 error ("imwrite: no extension found for %s to identify the image format",
106 filename); 106 filename);
107 endif 107 endif
108 warning ("imwrite: unlisted image format %s (see imformats). Trying to save anyway.", 108 warning ("imwrite: unlisted image format %s (see imformats). Trying to save anyway.",