Simulink block with dynamic input port width and fix output port width
9 ビュー (過去 30 日間)
古いコメントを表示
Hi, I'd like to have a custom Simulink block that accepts a 1-D signal of any positive length and outputs a 1-D vector of a fixed size of 256. I created a block with the Simulink block Builder and changed only the macro INPUT_0_WIDTH to -1 and the OUTPUT_0_WIDTH to 256.
My test scenario is a constant source that has the value [97 97 98 102 110 99 120] and is attached to my S-Function. The output port of my S-Function is connected to a Display sink.
Now when I start the simulation, it throws an error because of invalid input port width of my S-Function. The error messag is:
Error in port widths or dimensions. Invalid dimension has been specified for input port 1 of 'stringbuilder_test/S-Function'.
I also tried to use the DYNAMICALLY_SIZED constant instead of -1.
Edit: I tried to decrease the output width to the number of elements in the input signal and it worked. Then I increased the number of input elements equivalent to the width of my output width and it worked. It seems these two values are directly linked. Then I saw I set the direct feed-through flag to 1, so I set it to 0, but it did not have any effect.
Do you have any suggestions please?
0 件のコメント
回答 (1 件)
Kaustubha Govind
2014 年 7 月 10 日
"If the width is dynamically sized, the S-function must provide mdlSetInputPortDimensionInfo and mdlSetDefaultPortDimensionInfo methods to enable the signal dimensions to be set correctly during signal propagation."
Perhaps if you implement those methods, you can achieve what you need?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Sources についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!