📄 subsasgn.m
字号:
function s = subsasgn(s,index,val)
% SUBSASGN Define index assignment for stock objects
fc = fieldcount(s.asset);
switch index.type
case '()'
if (index.subs{:} <= fc)
s.asset = subsasgn(s.asset,index,val);
else
switch index.subs{:}-fc
case 1
s.numShares = val;
case 2
s.sharePrice = val;
otherwise
error(['Index must be in the range 1 to ', ...
num2str(fc + 2)])
end
end
case '.'
switch index.subs
case 'numShares'
s.numShares = val;
case 'sharePrice'
s.sharePrice = val;
otherwise
s.asset = subsasgn(s.asset,index,val);
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -