defining simulink variables through matlab srcript
3 次查看(过去 30 天)
显示 更早的评论
how can I define variables through matlab script? I am using trial version
0 个评论
回答(1 个)
galaxy
2019-10-29
You can create variables to workspace and in simulink, enable acess to base workspace.
For create variables via script, let 's try as following
v = genvarname('name_variable', who);
eval([v '= 1']); %% assign variable value
2 个评论
galaxy
2019-10-30
You must using "name_variable" in simulink model which same as workspace, and in model, please acess to base workspace as following
![2.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/245575/image.png)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!