Filter löschen
Filter löschen

Error when using predict DLblock in Simulink - Incorrect input size (#74.155.409)

8 Ansichten (letzte 30 Tage)
Hello, I am experiencing an issue when using the DL block predict in Simulink.
I plan to collect three scalars from sensors to concatenate them in a 1x3 vector to be fed as input in a pretrained feature regression NN, which is loaded from a .mat file. For sake of simplicity, in the simulink model I shared (please see the attached compressed folder), I replaced the sensors with three random number generators. Anyway, I receive the following error:
Error:Incorrect input size. The input data must have 3 columns.
Function 'Predict/MLFB' (#77.155.409), line 5, column 19:
"deep.blocks.internal.deepNetwork({in_1}, {size(in_1)}, {class(in_1)}, coder.cons"
I also tried a test: I collected the input in the workspace (please see the attached figure) to feed it in the NN (via Workspace), and I am able to collect a prediction with the following command:
Therefore, I would think that there is something wrong in the size (or the expected size) of the input in my simulink model.
Could you please help me with it?
Many thanks in advance,

Akzeptierte Antwort

Pavan Sahith
Pavan Sahith am 7 Feb. 2024
Bearbeitet: Pavan Sahith am 7 Feb. 2024
Hello Giovanni,
I understand that you are encountering an error related to the DL predict block input size in Simulink. The error indicates that the input data must have three columns.
I can see that you are using the 'Matrix Concatenate' block with 'vector' mode which could be causing this issue. When used in this mode, the output is a one-row or one-column matrix, potentially causing an error when fed into the 'Predict' block.
You can try the following steps to resolve the error:
  • Double-click on the 'Matrix Converter' block to access block parameters.
  • Adjust the number of inputs to 3 for your use case.
  • Change the mode to 'Multidimensional Array.'
  • Specify the concatenate dimension; I assume that it should be 2 in your case.
  • Click on 'Apply' and 'OK' to save the changes.
After making these adjustments, your model should run without encountering the specified error. For your convenience, I have attached an image after making the required changes.
If you want to know more about the Matrix Concatenate and DL Predict block, please refer to the following MathWorks documentation.
Hope this Helps!
  1 Kommentar
Giovanni am 11 Feb. 2024
Hello, Pavan, thank you very much for your answer and help.
I solved this issue by using the transpose block after the concatenation block.
Best regards,

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)


Mehr zu Deep Learning with Simulink 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!

Translated by