USING PERSISTENT VARS IN CUSTOM SIMULINK MATLAB FUNCTION
显示 更早的评论
Hello, I have a FOR loop that makes a call for a custom simulink matlab function block I wrote every iteration. The function block has persistent variables that are supposed to remember their values from previous calls, however currently they don't. What do I do wrong?
Thats how the initialization looks (I don't use CLEAR in between the calls):
function[] = custom_func()
persistent gen tstat hyst comps xvalve yvalve;
if (isempty(gen))
[gen, tstat, hyst, comps, xvalve, yvalve]=data_locker();
end
2 个评论
Jan
2016-11-2
Please do not use UPPERCASE, because this signals a SHOUTING and there is no reason to get upset here. Thanks.
Snus Mumrik
2019-7-2
Dear Sir,
There is really no need in wasting the time for both of us: for you to write and for me to read this. However, if you DO have a constructive comment on the question I had asked, I would be very thankful to read this.
Thanks.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Environment Customization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!