Hello Friends,
is there any way to kick start a custom function post simulation ?
What i want to do is i am changing a block paramter in init function ,after simultion i want to change the block paramter again to original
i am unable to do it in StopFcn.I am using matlab 2016b
Thanks in advance

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2020 年 6 月 10 日
編集済み: Fangjun Jiang 2020 年 6 月 12 日

0 投票

Try the PostSaveFcn.

12 件のコメント

Ajay krishna Vasanthakumar
Ajay krishna Vasanthakumar 2020 年 6 月 12 日
This will trigger only when we save the model.I need to change the dialog parameter immediately after termination
Thanks for your reply :)
Fangjun Jiang
Fangjun Jiang 2020 年 6 月 12 日
Why "i am unable to do it in StopFcn"? StopFcn is ran after the simulation stops.
Ajay krishna Vasanthakumar
Ajay krishna Vasanthakumar 2020 年 6 月 15 日
In stop function we can change the constant value and gain value but not other parameters :(
Fangjun Jiang
Fangjun Jiang 2020 年 6 月 15 日
I am curious. What parameter?
Ajay krishna Vasanthakumar
Ajay krishna Vasanthakumar 2020 年 6 月 15 日
i am not able to change the while loop - show iterator port parameter.
Fangjun Jiang
Fangjun Jiang 2020 年 6 月 15 日
You are right. It is odd that Simulink complaints "Cannot change number of ports while simulation is running" but the callback is "StopFcn". It is meant to run the command "after" the simulation stops.
Make an example and send a request to the Mathworks tech support. Ask their explaination why you can change other block parameters but not this one in "StopFcn". You can certainly do this using a separate script. Ask if they have a solution if you have to use a callback.
Ajay krishna Vasanthakumar
Ajay krishna Vasanthakumar 2020 年 6 月 15 日
sure Fangjun :).From 2017a we have a function called setPostSimFcn but prior to that we donot have any option.
Thanks alot for answering
Fangjun Jiang
Fangjun Jiang 2020 年 6 月 15 日
So, were you able to acomplish this task using setpostsimfcn?
Ajay krishna Vasanthakumar
Ajay krishna Vasanthakumar 2020 年 6 月 15 日
unfortunately iam working on R2016b.i have the to put the work on hold
Ajay krishna Vasanthakumar
Ajay krishna Vasanthakumar 2020 年 6 月 19 日
Hey Fangjun
have you used this function "SimCustomTerminator" ?
we have the simulink inbuilt function but i dont know how this works.
if you can share your knowledge on this, i can attain the possible solution !
Thanks
Fangjun Jiang
Fangjun Jiang 2020 年 6 月 19 日
No. Never used this property. I tried it in R2016b. It didn't do what you are expecting.
Ajay krishna Vasanthakumar
Ajay krishna Vasanthakumar 2020 年 6 月 20 日
Thanks a ton Fangjun =D

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeProgrammatic Model Editing についてさらに検索

製品

リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by