Question on Simulink Matlab Function

4 views (last 30 days)
Hello Everyone,
I'd like to ask something about the MATLAB Function in Simulink.
My project is try to use the MATLAB function to create a bitstream of the data (As frame) with variable output size depend on the input.
Here is my question.
1) Possible to set the MATLAB function output as dynamic variable size depend on the output of the function?
Example,
1st frame is generated data size = [200x1], After first frame output size should be 200x1
2nd frame is generated data size = [196x1], After second frame output size should be 196x1
2) The output from MATLAB Function must connect to the DBPSK modulation block (as below diagram)
But I got this error.
Error:Simulink cannot propagate the variable-size mode from the 'Output Port 1' of 'SigfoxTX/DBPSK Modulator Baseband/In1' to the 'Input Port 1' of 'SigfoxTX/DBPSK Modulator Baseband/M-DPSK Modulator Baseband'. This input port expects a fixed-size mode. The variable-size mode originates from 'SigfoxTX/MATLAB Function'. Examine the configurations of 'SigfoxTX/DBPSK Modulator Baseband/M-DPSK Modulator Baseband' for one of the following scenarios: 1) the block does not support variable-size signals; 2) the block supports variable-size signals but needs to be configured for them.
Below is original setting on Model Exploer.
When I uncheked the Variable size, I got this error instead.
Are there any way to fix this issue?
Thank you in advance.
PS. I also attached the simulink model for your reference.
Best Regards,
Fumihiko Sato

Accepted Answer

praguna manvi
praguna manvi on 30 Aug 2024
MATLAB Function block supports variable-size arrays for input and output types, it can be configured in Model Explorer, you can know refer more about its block properties here:
However, DBPSK Modulator Baseband doesn’t support variable-sized arrays you can confirm it view the supported data types by running:
showcommblockdatatypetable
A possible workaround fix to resolve this issue is to either truncate or pad the output of the MATLAB Function block to a fixed size.

More Answers (1)

Aravind
Aravind on 30 Aug 2024
The “DBPSK modulator” block in Simulink, does not support variable-size input signals. Hence, you are receiving an error regarding this, when your “MATLAB function” block is outputting a variable-size signal. More information on which Simulink blocks in the Communications Toolbox support variable-size signals, run the “showcommblockdatatypetablefunction from the MATLAB Command line.

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!