Parameters from MATLAB function in Simulink

조회 수: 3 (최근 30일)
Jasper Mattijs
Jasper Mattijs 2014년 5월 6일
댓글: Santosh Gnanasekaran 2018년 1월 1일
Hi
I'm writing a function in MATLAB. In this function I call a Simulink diagram with following command: sim('diagram', 'vxin', value) The error I get is: block_diagram does not have a parameter named 'vxin'. In the diagram I have a constant block where I entered vxin. Clearly this isn't the right way.
How can I fix this?
Thanks
  댓글 수: 1
Santosh Gnanasekaran
Santosh Gnanasekaran 2018년 1월 1일
Probably 'vxin' is not in the base workspace as its value is undefined. you can assign any constant\variable in simulink pertaining to that particular block and then try again.

댓글을 달려면 로그인하십시오.

채택된 답변

A Jenkins
A Jenkins 2014년 5월 6일
편집: A Jenkins 2014년 5월 6일
It depends on how you want to manage the scope of vxin .
Simple option:
vxin=value;
sim('diagram');
or maybe you want something like:
h=get_param('diagram','modelworkspace');
h.assignin('vxin',value);
sim('diagram');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by