MATLAB if...end 语句 |
您所在的位置:网站首页 › matlab中的if语句怎么用 › MATLAB if...end 语句 |
MATLAB if 语句语法 在MATLAB中 的 if 语句的语法是: if % statement(s) will execute if the boolean expression is true end表达式的计算结果如果是“true”,那么在代码块中,如果语句会被执行。如果表达式计算结果为“false”,那么第一套代码结束后的语句会被执行。 MATLAB if 语句流程图:![]() 在MATLAB中建立一个脚本文件,并输入下述代码: a = 10; % check the condition using if statement if a < 20 % if condition is true then print the following fprintf('a is less than 20 ' ); end fprintf('value of a is : %d ', a);运行该文件,显示下述结果: a is less than 20 value of a is : 10 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |