diff scripts/image/private/imageIO.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 15db54c4a572
children 6ca096827123
line wrap: on
line diff
--- a/scripts/image/private/imageIO.m	Sat Mar 01 22:11:32 2014 -0800
+++ b/scripts/image/private/imageIO.m	Sun Mar 02 12:56:11 2014 -0800
@@ -84,13 +84,13 @@
     foo = []; # the function we will use
 
     ## We check if the call to imformats (ext) worked using
-    ## "isempty (fieldnames (fmt))" because when it fails, the returned
+    ## "numfields (fmt) > 0 because when it fails, the returned
     ## struct is not considered empty.
 
     ## try the second input argument
     if (! isempty (varargin) && ischar (varargin{1}))
       fmt = imformats (varargin{1});
-      if (! isempty (fieldnames (fmt)))
+      if (numfields (fmt) > 0)
         foo = fmt.(fieldname);
         varargin(1) = []; # remove format name from arguments
       endif
@@ -104,7 +104,7 @@
         ext = ext(2:end);
       endif
       fmt = imformats (ext);
-      if (! isempty (fieldnames (fmt)))
+      if (numfields (fmt) > 0)
         foo = fmt.(fieldname);
       endif
     endif