我有以下matlab代码v是一维数组。
v = getV(x,y,z);
if isempty(v)
fail_code = 1;
elseif max(v) <= vmax % <============== error is here
fail_code = 0;
vplus = max(v);
else
vplus = vmax;
end
这工作正常,但是当我尝试在 matlab 编码器中将其转换为 ac 代码时,出现以下错误:
Expected a scalar. Non-scalars are not supported in IF or WHILE statements, or with logical operators. Instead, use ALL to convert matrix logicals to their scalar equivalents.
我对 matlab 数据类型并不完全熟悉,也许是我遗漏了什么的原因。