fieldnames.m

来自「toolbox of BVQX, This is the access betw」· M 代码 · 共 70 行

M
70
字号
function names = fieldnames(S)
% BVQXfile::fieldnames  - overloaded method (completion, etc.)
%
% method used for getting property list (and methods), especially
% for the auto completion feature in the GUI

% Version:  v0.7b
% Build:    7082921
% Date:     Aug-29 2007, 9:54 PM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% persistent methods
persistent bvqxfile_methods;
if isempty(bvqxfile_methods)
    bvqxfile_methods = BVQXfile(0, 'methods');
end

% only valid if not empty
if isempty(S)
    names = {};
    return;
end

% get structed version and lookup
sfile = struct(S);
if ~isempty(sfile)
    try
        sc = bvqxfile_getscont(sfile(1).L);
    catch
        error( ...
            'BVQXfile:InvalidObject', ...
            'Memory of object freed.' ...
        );
    end
end

% get file type
stype = lower(sc.S.Extensions{1});

% return original names
names = fieldnames(sc.C);

% add methods if any
if isfield(bvqxfile_methods, stype)
    tm = bvqxfile_methods.(stype);
    mf = fieldnames(tm);

    % iterate
    nnames = numel(names);
    names(nnames + numel(mf)) = names(nnames);
    for mc = 1:numel(mf)
        sm = tm.(mf{mc});
        up = find(sm == '_');
        names{nnames + mc} = sm(up(1)+1:end);
    end
end

% add AFT methods
tm = bvqxfile_methods.aft;
mf = fieldnames(tm);

% iterate
nnames = numel(names);
names{nnames + numel(mf)} = '';
for mc = 1:length(mf)
    sm = tm.(mf{mc});
    names{nnames + mc} = sm(5:end);
end

⌨️ 快捷键说明

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