simulink error:Class mismatch for variable 'exist'. Expected 'logical', Actual 'double'.
2 次查看(过去 30 天)
显示 更早的评论
I get a error in a MATLAB function block
coder.extrinsic('exist');
N=1296;
if exist('w_1','var')
W1=w_1;
else
W1=zeros(N,1);
end
0 个评论
回答(1 个)
chengxuan yu
2018-4-1
编辑:Walter Roberson
2018-4-1
Because 'exist' return a double value and 'if' need to follow a logical value.
you can modify the code like this:
if isequal(exist('w_1','var'),1)
W1=w_1;
else
W1=zeros(N,1);
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!