S-function documentation that "S-function level-1 supports vector inputs and outputs. DOES NOT support multiple input and output ports".
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Kaustubha Govind
el 16 de Jul. de 2013
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 comentarios
yuge sun
el 3 de Nov. de 2020
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.
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!