matlab structure learning

Next, the basic operations of the structure set forth
above all create a structure
s1 = struct ( 'name', { 'zhangsan', 'lisi'}, 'age', { '23', '24'}, ' sex '{' nan '})
to delete a member variable, by rmfield, rm to be appreciated remove.
shanchu = rmfield (s1, 'sex '); Gender structural body can be deleted by the statement variables.
shanchu = rmfield (s1, { ' name', 'lisi'}); structural body may be the name John Doe is deleted by the statement.
To determine whether it is a member or structure variables can be determined by a function isfield isstruct and used as follows:
F1 = isstruct (s1); return structure 1, is a structure represented by s1.
f2 = isfield (s1, 'name '); return result is a 1, showing the structure of s1 name is variable.
Of the structures were performed by alphabetical order, by orderfields function, used as follows:
F3 = orderfields (S1);

Released six original articles · won praise 1 · views 94

Guess you like

Origin blog.csdn.net/weixin_45143788/article/details/105181923