subsref.m

来自「hilbert-huang 变换的源码 蛮有用的」· M 代码 · 共 26 行

M
26
字号
function x=subsref(c,s)
% COMPONENTS/SUBSREF handles c(s) for Components structures

switch s(1).type
    case '()'
        ind = s.subs{:};
        if length(ind) ~= 1
            error('Indexing multiple components at a time is not implemented.');
        end
        x=get(c,'data',ind(1));
    case '.'
        if length(s)==1
            x=get(c,s(1).subs);
        elseif length(s)==2
            if length(s(2).subs) == 1
                x=get(c,s(1).subs,s(2).subs{1});
            else
                error('Indexing multiple components at a time is not implemented.');
            end
        else
            error('Subscripting more than two levels is not supported.');
        end
    otherwise
        error('Subscripting error; check your syntax.');
end

⌨️ 快捷键说明

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