S-function documentation that "S-function level-1 supports vector inputs and outputs. DOES NOT support multiple input and output ports".
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Kaustubha Govind
2013-7-16
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!