Script to function help
显示 更早的评论
So I have a script that uses simulink, and it calls upon stuff saved in workspace, but I now need to change the script into a function that gives me 4 outputs and accepts 20 inputs. I have something like this set up:
function[a,b,c,d] = myfunc(x1,x2,x3,...x20)
but the problem I'm getting is that the simulink is not getting any values being saved. I think it has to do with functions not saving to the normal workspace. What I'm trying to find out is how I can just make my whole function save its variables into workspace?
回答(1 个)
Azzi Abdelmalek
2013-10-15
0 个投票
6 个评论
Gilmar
2013-10-15
Azzi Abdelmalek
2013-10-15
Can you explain how your functions are used in your Simulink model?
Gilmar
2013-10-17
Azzi Abdelmalek
2013-10-17
编辑:Azzi Abdelmalek
2013-10-17
If I've understood, You run your script, after you run your simulink model which will save some result via to workspace block. At the end of your simulation you will run another script. Until now I don't know what is your problem?
Azzi Abdelmalek
2013-10-17
编辑:Azzi Abdelmalek
2013-10-17
Just use the variables needed by simulink model v1,v2,...as output argument in your function
[var1,var2,...]=you_function(x1,...)
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!