How do I output an array from my level 2 S Function? Please help!

Hi there,
I have a S function that takes arrays as inputs from an excel file and does computations using the arrays. The ultimate result in the S function block is a Nx1 array. I have tried assigning the Nx1 array to the sFunc.OutputPort(1).Data, but it gives me error saying I am attempting to assign a length N vector to a length 1 vector.
I want to be able to output the array and feed it into another S function in Simulink and to a scope to plot the data against another array (time).
Any help would be greatly appreciated!
Thanks!

댓글 수: 1

Ryan G
Ryan G 2012년 7월 16일
편집: Ryan G 2012년 7월 16일
Are you attempting to use the variable, N, to assign the length of the array or a number?

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

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 7월 16일

1 개 추천

Have you configured block.OutputPort(1).Dimensions to N?

댓글 수: 2

Hey Kaustubha,
I tried defining block.OutputPort(1).Dimensions to -1 (inherited or dynamic) and also to N, but it still doesn't work. It shows the same error message.
What is the S-function output connected to? Is it a block that is expecting a scalar somehow? Try connecting it to an Outport block to make sure that there is no backward propagation happening.

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

카테고리

도움말 센터 및 File Exchange에서 Simulink에 대해 자세히 알아보기

제품

질문:

2012년 7월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by