필터 지우기
필터 지우기

Problem with variable size output/input signals in Embedded Function Blocks in Simulink

조회 수: 1 (최근 30일)
Hello Everyone ,
Problem Situation : I have a M Function which i need to use in Simulink . lets say that I need to use following function.
function [a,b] = foo(p,q,r)
%#codegen
% Some operation
end
So , Regarding this Function, Some of the inputs are constants, some of them are varying size input/outputs for different time steps. When I was trying to run the model ,it did throw me a warning saying about the varying sizes of inputs/outputs. Then I went to model explorer, and did navigate to the Corresponding function , and checked the "variable size" box for variable inputs/outputs and left the size as -1... For those as constants , I gave the size as [1 1] and leaving the "variable Size" unchecked.
but still I get an error Like
Output 'OutputLaneData' has variable size but the upper bound is not specified; explicit upper bound must be provided.
Do i need to explictly mention the maximum limits of all outputs in the function like this
function [a,b] = foo(p,q,r)
%#codegen
coder.varsize('a',[1 10000]); % The Maximum size of a can be [1 x 10000]
coder.varsize('b',[1 99999]); % The Maximum size of a can be [1 x 99999]
% Some operation
end
Even though I did something like to this to my functions, it still complains me . I even did add maximum and minimum values in the model explorer... Do i still need to do something more ?? Am i missing anything ...
please comment to know about it... Any questions are welcome.
  댓글 수: 3
Ash1992
Ash1992 2017년 2월 27일
Hello Vandana .... The operations include some searching,filtering and Yes,I am performing some concatenation of those outputs with some constants if a conditions satisfies.
Sudarshan Kolar
Sudarshan Kolar 2017년 2월 27일
편집: Sudarshan Kolar 2017년 2월 27일
You might find these docs helpful to resolve the issue:
1. https://www.mathworks.com/help/coder/ug/code-generation-for-variable-size-data.html (see generating code for MATLAB Functions with Variable-Size Data and the section after it)
2. https://www.mathworks.com/help/coder/ug/troubleshooting-issues-with-variable-size-data.html#br9sjhb
3. https://www.mathworks.com/help/coder/ug/variable-size-data-when-dynamic-memory-allocation-is-disabled.html#br9t1u3
The doc is suggesting to use coder.typeof:
https://www.mathworks.com/help/coder/ref/coder.typeof.html?s_tid=srchtitle

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

답변 (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