Calling Simulink model in a function
38 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a Simulink model using the variable V in a gain block. I want to perform a parameter analysis and therefor have to start the simulation several times with the command sim.
This works fine if I do this in the command window or using a script.
If I call sim in a function, and the parameter V for the model is an argument of the function, the model will not recognize the variable inside the function. Can someone give me explantion for this behaviour?
Michael
0 个评论
回答(2 个)
Iain
2014-1-24
Simulink uses the base workspace. You can assign the variable in the base workspace using assignin or evalin.
Alternatively, you can set up your model to accept a time series input and supply that from your function.
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!