📄 subsref.m
字号:
function ans = subsref(obj,s)
%SUBSREF Method for fdax object
% Author: T. Krauss
% Copyright (c) 1988-98 by The MathWorks, Inc.
% $Revision: 1.3 $
if strcmp(s(1).type,'()')
obj = struct(obj);
obj = obj(s(1).subs{:});
obj = fdax(obj);
s(1) = [];
end
if isempty(s)
ans = obj;
return
end
switch s(1).type
case {'()','{}'}
error('Sorry, I don''t understand this construct.')
case '.'
ans = get(obj,s(1).subs);
end
if length(s)>1
% subsref into ans
ans = mysubsref(ans,s(2:end));
end
function ans = mysubsref(ans,s)
for i=1:length(s)
switch s(i).type
case '()'
ans = ans(s(i).subs{:});
case '{}'
ans = ans{s(i).subs{:}};
case '.'
ans = getfield(ans,s(i).subs);
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -