Dynamically Sized S-function Builder Inputs

28 ビュー (過去 30 日間)
Matthew
Matthew 2014 年 10 月 25 日
コメント済み: Matthew 2014 年 10 月 27 日
Coming into my S-Function Builder block, I have a one-dimensional signal that could be anywhere from 1 to 17 uint8's in length. Within the S-Function Builder block, my input has the following specifications:
Dimensions: 1-D
Rows: -1
Data type: uint8
As per the documentation, setting the Rows parameter to -1 should size the input dynamically.
However, I get the following error message:
Error due to multiple causes.
  • Error in port widths or dimensions. Invalid dimension has been specified for input port 1 of 'LCDcount/S-Function Builder'.
  • Error in port widths or dimensions. Output port 1 of 'LCDcount/Format Time' is a one dimensional vector with 9 elements.
I expect the signal to be 9 elements (I attached a constant block directly to the S-Function Builder input as a test case to replace my original configuration, which was a MATLAB function - no difference between the errors). Simulink writes a 9 next to the previous block's output, but places a (?) symbol at the input to the S-Function Builder block.
I have no idea how to go about debugging this one, so any help would be appreciated! Thanks!

採用された回答

Sandip Kumar
Sandip Kumar 2014 年 10 月 27 日
Yes the documentation is correct, in specifying that the dimension of the input can be dynamically sized. I quickly played with an example, and attaching it here.
Make sure to build the s-function builder block to get the mexw64 files for the block to simulate.
This should give you some ideas to fix the issue you are facing.
Thanks, Sandip
  1 件のコメント
Matthew
Matthew 2014 年 10 月 27 日
I think the issue was that at the time, I was guaranteeing an input size of 9x1 as the output vector of my matlab function, without specifying that the variable could be of variable size. However, in the model explorer dialog, I could check the box that specifies them as having variable size, and this would eliminate that error. So I was actually able to get that part working. After that, I tried to have multiple variable size inputs to an s-function builder, but that seems to be completely unsupported, as the s-function builder blocks don't even build at all any more at that point.
Regardless, I appreciate your response! Thanks, Matt

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by