Script to function help
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2013년 10월 15일
댓글 수: 6
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,...)
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!