Intreact between simulink and matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
HI, can I known how can I call the m file from the matlab fucntion block in simulink?
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 4월 25일
편집: Walter Roberson
2021년 4월 25일
The usual way: just name the function and pass in any appropriate arguments. Simulink will search for functions with that name along the MATLAB path.
If the question is how you can tell at MATLAB Function Block to use a particular file as the code to be executed, instead of typing in the code to the block editor, then the answer is that you cannot do that. The source code for MATLAB Function Blocks is stored inside the model. However, you can use a MATLAB Function Block that does nothing other than initialize the output variables (so it knows the types and sizes), and then call the MATLAB function to do the real work.
댓글 수: 2
Walter Roberson
2021년 4월 25일
What is the error message that you observe?
You only have a single variable, that can only take the values 0 and 1, and you have a linear equality. You do not need intlinprog for this purpose; you can calculate the two possibilities directly.
참고 항목
카테고리
Help Center 및 File Exchange에서 Model Verification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!