正在加载图片...
恒润科技 HiRain Technologies HIRAIN TECHNOLOGIES 逻辑控制程序结构 ■条件语句的使用 ■ MATLAB中的跳转一一旦条件为真,或条件匹配,则中断 当前的顺序执行方式 ■涉及字符串操作时使用 switch-case语句比 elseif更有效 if工 switch algori thm A(工,J)=2 case 'ode23 elseif abs(I-j)== 1 str = 2nd/3rd order I A(工,J)=-1; 1 case [ ''ode23s' A(,J)=0; str= 'stiff system'i end otherwise str ' other algori thm'i end >>if examp switch examp www.hirain.com5 逻辑控制程序结构  条件语句的使用  MATLAB中的跳转—一旦条件为真,或条件匹配,则中断 当前的顺序执行方式  涉及字符串操作时使用switch-case语句比elseif更有效 if I == J A(I,J) = 2; elseif abs(I-J) == 1 A(I,J) = -1; else A(I,J) = 0; end switch algorithm case 'ode23' str = '2nd/3rd order'; case {'ode15s', 'ode23s'} str = 'stiff system'; otherwise str = 'other algorithm'; end >> if_examp >> switch_examp
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有