S-function documentation that "S-function level-1 supports vector inputs and outputs. DOES NOT support multiple input and output ports".
이전 댓글 표시
Dear Sir/Madam,
I read in S-function documentation that "S-function level-1 supports vector inputs and outputs. DOES NOT support multiple input and output ports".
Does the second sentence mean the input and output dimension MUST BE SAME?
I have been using S-function level-1 to do the following:
[a1, b1] = choose_cells(c, d);
where a1 and b1 are outputs, c and d are inputs. All the variables are having a single value, except d is an array with 6 values.
Referring to the image attached, we all know that in S-function block, the input dimension must be SAME as output dimension, else we will get error, in this case, the input dimension is 7 while the output dimension is 2, so I have to include the "Terminator" blocks in the diagram for it to work perfectly, otherwise, I will get an error.
My problem is, when the system gets bigger, the array d could contain hundreds of variables, using this method, it means I would have to add hundreds of "Terminator" blocks in order to get this work, this definitely does not sound practical.
Could you please suggest me a wise way to implement this?
Thanks in advance.
답변 (1개)
Kaustubha Govind
2013년 7월 16일
0 개 추천
Is there a reason that you would not like to upgrade to Level-2 S-functions? Level-1 S-functions have been deprecated for several years and only exist for the sake of backwards compatibility.
Since Level-1 S-functions have been deprecated, I can't find documentation on how you can configure the size of the output to not be the same as the size of the input (I'm not sure if it's even possible). I would recommend that you convert your Level-1 S-function to Level-2, so you can configure the dimensions of the input and output appropriately, using block.InputPort(1).Dimensions and block.OutputPort(1).Dimensions.
댓글 수: 2
yuge sun
2020년 11월 3일
Dont use level-2 function, u will regret for its running speed. Level-2 function has low speed and still has lots of problem which doesnt suitable for user to develop block friendly.
카테고리
도움말 센터 및 File Exchange에서 Configure Block Features for MATLAB S-Functions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!