Why the models stays in "paused after initialisation" state?
3 次查看(过去 30 天)
显示 更早的评论
Hello all, Before Matlab R2013b I did not have a problem with this... I did a model compilation programmatically like this:
eval([bdroot '([],[],[],''compile'')']);
disp(' ');disp('Model compiled!');disp(' ');
eval([bdroot '([],[],[],''term'')']);
disp(' ');disp('Model terminated!');disp(' ');
It worked just fine. Now the model remains stuck in "paused after initialization" state and does not get out of this state even using GUI. You have to forcibly close Matlab in order to modify/save/update/do anything else with the model.
Did someone else had this problem or knows a way to make sure the model is compilable without going into this kind of trouble?
Thank you!
4 个评论
A Jenkins
2015-1-30
Since I can't reproduce it, I am suspecting your compiler. I get the following:
Model opened!
Model compiled!
Model terminated!
Model closed!
Keith Rogers
2015-5-4
I'm getting a similar problem. I'm trying to make use of the CompiledSampleTime property of a block, but finding that if I change the sample time then I have to compile twice to get it to work, because the first time it goes through it uses the previously compiled time. In attempting to get around this, I used the modelname([],[],[],'compile') command. Now my model window shows "Paused" in the bottom left, and if I try to do modelname([],[],[],'term') I just get the warning:
Warning: Termination of '<modelname>' deferred
回答(2 个)
Daniele Defilippi
2017-8-2
The issue can be solved in Matlab 2017b in the following way:
eval([bdroot '([],[],[],''compile'')']);
disp(' ');disp('Model compiled!');disp(' ');
eval([bdroot '([],[],[],''sizes'')']);
eval([bdroot '([],[],[],''term'')']);
disp(' ');disp('Model terminated!');disp(' ');
The sizes command enables model termination.
0 个评论
Aleksey Trubitsyn
2021-11-8
Your usage looks right to me. There are a couple of things you can check here:
1) bdroot may refer to a different model after the call to compile. This can happen if the top model contains referenced model or if there are any model callbacks which interact with another model. Or if you simply click on another model between the call to compile and terminate. I suggest using a more explicit syntax to avoid this:
>> mdl = 'myModel'
>> feval(mdl, [], [], [], 'compile')
2) if the original code snippet is more than what you've shown, this may be due to the queued behvaior of compile and terminate commands: if compile command was issued more than once on the same model, without any calls to term in between, you would need to call term the same number of times to actually termiante the compilation. You should see warnings in this case though. For example:
>> feval(‘myModel’,[],[],[],’compile’);
>> feval(‘myModel’,[],[],[],’compile’); % Warning: myModel is already compiled
>> feval(‘myModel’,[],[],[],’term’); % Warning: Termination of 'myModel' deferred
>> feval(‘myModel’,[],[],[],’term’); %no warning; model compilation is undone.
Btw, I tried this in R2022a, and i see the compiled state labeled as 'compiled' on the UI, after the compilation call.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Environment Customization 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!