📄 subsref.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -