[未答复] matlab function 循环嵌套以后报错说在某些情况没有给输出赋值

[复制链接]
长寿 发表于 6 天前
20 财富积分

本帖最后由 长寿 于 2021-6-8 14:41 编辑

function u11 = fcn(wu1)
umax=1;
umin=-1;
B=0;
niu=0.1;
uniu=umax-niu;
while uniu>umin
wniu=uniu;
if wniu<wu1
    u11=uniu+(1/2)*niu;
    B=1;
    break;
end
niu=niu+0.1;
uniu=umax-niu;
end
if B==0
    u11=1;
end
end

simulink

simulink

报错:Output argument 'u11' is not assigned on some execution paths.
Function 'MATLAB Function' (#23.9.12), line 1, column 10:"u11"Launch diagnostic report.


Component:MATLAB Function | Category:Coder error



Errors occurred during parsing of MATLAB function 'TTT/MATLAB Function'


Component:MATLAB Function | Category:Coder error



Errors occurred during parsing of MATLAB function 'TTT/MATLAB Function'


Component:Simulink | Category:Model error



您需要登录后才可以回帖 登录 | 注册

本版积分规则

相关帖子
热门教程
站长推荐
快速回复 返回顶部 返回列表