Error: When loading a matrix input, the blocks loading the corresponding data columns of the matrix must specify dimension using a scalar

5 views (last 30 days)
I use MATLAB to create a variable weights. This variable is 11x216 in size.
I have a Simulink Inport, which expects an input matrix of 11x216.
I save the variable weights alongside other variables in a *.mat file.
Then, I use the Inport functionality of Simulink to import that *.mat file and use the Map Mode "Port Order" to input the data into my model.
However, I get the warning:
> When loading a matrix input, the blocks loading the corresponding data columns of the matrix must specify dimension using a scalar
This makes no sense to me.
  1. How to specify a matrix (2D!) with one scalar?
  2. Okay, they mean each data column. But how exactly do I specify the dimension of that data column? The inports do not provide such a functionality.
Can anyone help me here? I dont know what this error means. My variable type/dimensions match up with the input dimensions of that port.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 10 Feb 2023
In R2022b, open this doc and see the example model.
To import 2D data, there is a specific format which should be the same regardless from .mat file or from workspace.
web(fullfile(docroot, 'simulink/slref/read-2d-signals-in-structure-format-from-workspace.html'))

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!