필터 지우기
필터 지우기

Access a different input-argument, when calling a fucntion

조회 수: 3 (최근 30일)
Leon
Leon 2022년 12월 19일
답변: Denis Gurchenkov 2022년 12월 19일
For my Real-Time model in Simulink, I use "MATLAB Function" in which I need to specify, that one specific array (in my case, it is "H_R") is going to have variable-size dimensions from [1 1] to [1 125]. For that, I was trying to use the function coder.varsize(). However, when compilating, I receive an error:
Output 'H_R' has variable size but the upper bound is not specified; explicit upper bound must be provided.
In order to fix this error, It is needed to access the argument "ubounds" in the function coder.varsize(), but unfortunetly it is not possible and Simulink thinks I am trying to specify another variable:
Is it a bug or am I missing something? How can I access the "ubounds"-argument?
P.S. In the documentation example, the upper bound is also represented without a comma (i.e. [1 5]), but I think it is just a typo.
P.S.S The "variable size" is also allowed in the "Model Explorer"
  댓글 수: 1
Jan
Jan 2022년 12월 19일
편집: Jan 2022년 12월 19일
My idea, to move the coder.varsize command before the defition, does not match, and I've deleted my answer. See this example from the documentation:
x = 1;
coder.varsize('x');
disp(size(x));

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

답변 (1개)

Denis Gurchenkov
Denis Gurchenkov 2022년 12월 19일
This error message suggests you to open the Symbols pane in the MATLAB Function block and enter the upper bound size for this output (H_R) in there (check the "Variable size" checkbox and enter the size as [1, 125] in the dialog). Same can be done in the Model Explorer. Can you please try that and see if the error goes away?
Once you do that, you can remove the coder.varsize declaration.

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by