作业帮 > 综合 > 作业

matlab 这个函数哪里出错了

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/16 14:29:03
matlab 这个函数哪里出错了
fuction [ou1,ou2]=xuhaoyi(in1,in2,in3)
%mytest is used to do the question
% Purpose:If input1 is between 60 and 70 and input2 is between 20 and 25 and input3 is above 90,% then output1 is true and output 2 is 1.
% If input1 is between 65 and 75,and input2 is between 25 and 30 and input3 is above 80,then % output1 is true and output 2 is 0.
% Otherwise input1 is false and output2 is 0.
% Define the variables:
% msg -- error message
%
% Do the question
if in1=60 & in2>=20 && in290
ou1=1; ou2=1;
elseif in1=65 & in2>=25 && in280
ou1=1; ou2=0;
else
ou1=0; ou2=0
end
这个自定义的函数哪里出现了错误?
if in1=60 && in2>=20 && in290
ou1=1; ou2=1;
elseif in1=65 && in2>=25 && in280
ou1=1; ou2=0;
else
ou1=0; ou2=0
end
再问: 但是我那样也是对的啊,为什么系统就是运行不了,当我使用这个函数,他总说我什么regard script as function
再答: 你不能直接从editor里运行,你编的是函数,得先把函数保存到当前目录,在command window里输入xuhaoyi(xx, xx, xx),就会显示结果了~~