在matlab中如何设计一个程序
在matlab中如何设计一个程序
代码已经验证:
徐文力 新浪博客
clc
clear all
close all
%%
flag=1
while flag== data=input(Please enter something:,s)
if strcmp(data,)==0 %判断输入是否为空
msgbox(I get the command!)%若非空
if strcmp(data,exit) %若非空,且为exit
msgbox(Goodbye!) %输出goodbye并退出
flag=0 %标志位清零,停止循环
else
msgbox(I am processing your commands...)%若非空,且非exit
end
else
%若为空,则do nothing,继续循环
end
end