Simulink block with dynamic input port width and fix output port width
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Kaustubha Govind
am 10 Jul. 2014
"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 Kommentare
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!