clear persistent in function simulink
3 次查看(过去 30 天)
显示 更早的评论
hallo,
i need to clear persistent in simulink function when ytyt==15 but it say this:
Function 'clear' is not supported for code generation and the coder.extrinsic directive cannot be applied to 'clear'. Rewrite your code so it does not use 'clear'.
so how i can do it ?
function y = fcn(u)
persistent ytyt;
if isempty(ytyt)
ytyt=u
end
ytyt=ytyt+1
if ytyt == 15
clear ytyt
end
y = ytyt
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!