isfield.m

来自「这是MATLAB小型的。下下去看看嘛」· M 代码 · 共 18 行

M
18
字号
function tf = isfield(s,f)
%ISFIELD True if field is in structure array.
%   F = ISFIELD(S,'field') returns true if 'field' is the name of a field
%   in the structure array S.
%
%   See also GETFIELD, SETFIELD, FIELDNAMES.

%   Copyright 1984-2002 The MathWorks, Inc. 
%   $Revision: 1.13 $  $Date: 2002/04/08 19:22:48 $

if isa(s,'struct')  
  tf = any(strcmp(fieldnames(s),f));
else
  tf = logical(0);
end


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?