필터 지우기
필터 지우기

How can I set input value and output value of a StartFcn?

조회 수: 1 (최근 30일)
Xiangming Hao
Xiangming Hao 2017년 5월 25일
댓글: Xiangming Hao 2017년 5월 26일
Hi,
I'm trying to set input value and output value of a StartFcn. I know that the form like " set_param(model_name,'StartFcn','functionname') " is right. But I want to know, whether " set_param(model_name,'StartFcn','[a,b]=functionname(c,d)') " is also right. When not, are there anyway to make it?
Thanks for any help you can give me,
Xiangming

답변 (1개)

Sebastian Castro
Sebastian Castro 2017년 5월 25일
Did you try it? Because it works fine for me.
Pretty sure the value of a model's StartFcn parameter is just a free-form string, so any valid set of MATLAB expressions will work. For example:
set_param(bdroot,'StartFcn',['x = 1' char(10) 'y = sin(x);' char(10) '[a,b] = functionname(c,d);'])
(Here, char(10) is the line break character)
- Sebastian
  댓글 수: 3
Sebastian Castro
Sebastian Castro 2017년 5월 26일
Well, are there variables c and d defined before you call that function? You'd need those too.
Xiangming Hao
Xiangming Hao 2017년 5월 26일
Hi Sebastian,
I think i have already define the variable c and d before the Code:
set_param(model_name,'StartFcn','[a,b] = test_function(c,d)');

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

카테고리

Help CenterFile Exchange에서 Scopes and Data Logging에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by