필터 지우기
필터 지우기

Why the models stays in "paused after initialisation" state?

조회 수: 7 (최근 30일)
Adrian
Adrian 2015년 1월 29일
답변: Aleksey Trubitsyn 2021년 11월 8일
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
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
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
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.

Aleksey Trubitsyn
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.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by