⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subsasgn.m

📁 matlab实用教程
💻 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 + -