octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getstruct, setstruct, etc.


From: Andy Adler
Subject: getstruct, setstruct, etc.
Date: Wed, 21 Jul 2004 16:21:37 -0400 (EDT)

I'm in the process of getting a project to work on both Matlab and
Octave (a medical imaging toolkit: eidors3d.sf.net)

I've noticed that Matlab's structure functions work quite differently
than those of octave. The problem is that the octave-forge function does
not allow one to access deeply nested subfields easily.

QUESTION:
Is anyone feel strongly about changing the octave-forge functions
to be closer to Matlab?

QUESTION#2:
Matlab claims that GETFIELD is deprecated in favour of "dynamic
field names". Does anyone know what the *$#@ that is?

Andy

e.g.
OCTAVE:

  help getfield

 - Built-in Function:  [V1,...] = getfield (S, 'k1',...) = [S.k1,...]
     Return selected values from a struct. Provides some compatibility
     and some flexibility.

MATLAB:
>> help getfield

 GETFIELD Get structure field contents.
    F = GETFIELD(S,'field') returns the contents of the specified
    field.  This is equivalent to the syntax F = S.field.
    S must be a 1-by-1 structure.

    F = GETFIELD(S,{i,j},'field',{k}) is equivalent to the syntax
         F = S(i,j).field(k).
    In other words, F = GETFIELD(S,sub1,sub2,...)  returns the
    contents of the structure S using the subscripts or field
    references specified in sub1,sub2,etc.  Each set of subscripts in
    parentheses must be enclosed in a cell array and passed to
    GETFIELD as a separate input.  Field references are passed as
    strings.

    Note that if the evaluation of the specified subscripts results
    in a comma separated list, then GETFIELD will return the value
    corresponding to the first element in the comma separated list.

    NOTE:  GETFIELD is deprecated.  Please see the documentation for
    dynamic field names for accessing structure fields.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]