I want to carry simulink variable (eg. PID parameters)to mfile. After I process in mfile, I will send to simulink model. How can I do this. Could you suggest any way for me?
Do you mean to do processing of the parameters offline (run the model once, save parameters, process them, then run model a second time), or during model simulation?
No. Once model run (example: 0-5 second) and end of the 5 second model simulation stop. After that, I send the variables to mfile, m file run, I send variables to simulink. This loop will continue until loop will be end.
1) use get_param to obtain Simulink model parameters, and use set_param to set them
2) Use variables in your Simulink model parameters, and define them in the base workspace. You can set these values using your m file, and then run the Simulink model.
3) If you run your Simulink model using the sim command, you can pass in model parameter values.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
3 Comments
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/1310-how-can-i-get-and-set-variables-like-pid-parameters-in-a-simulink-model-from-an-mfile#comment_2299
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/1310-how-can-i-get-and-set-variables-like-pid-parameters-in-a-simulink-model-from-an-mfile#comment_2299
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/1310-how-can-i-get-and-set-variables-like-pid-parameters-in-a-simulink-model-from-an-mfile#comment_2423
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/1310-how-can-i-get-and-set-variables-like-pid-parameters-in-a-simulink-model-from-an-mfile#comment_2423
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/1310-how-can-i-get-and-set-variables-like-pid-parameters-in-a-simulink-model-from-an-mfile#comment_2585
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/1310-how-can-i-get-and-set-variables-like-pid-parameters-in-a-simulink-model-from-an-mfile#comment_2585
Sign in to comment.