How to export a column vector from a "MATLAB Function" block without seeing the “Cannot Save Outputs in the ‘Array’ Format” error?

I have a Simulink model which contains a "MATLAB Function" block. The "MATLAB Function" block code outputs a column vector of values.
However, when trying to output these values using an "Outport" block, I see the error message below:
Cannot save outputs in the 'Array' format because signals connected to the root outports of model 'MyModel' are not scalar or 1-D arrays. Set 'Configuration Parameters > Data Import/Export > Format' to 'Dataset', 'Structure' or 'Structure with time'.
How can I resolve this error to export a column vector from my "MATLAB Function" block?

 採用された回答

MathWorks Support Team
MathWorks Support Team 2026 年 4 月 4 日 0:00
MATLAB interprets a column vector as a matrix of size [N x 1] while Simulink interprets a column vector as a 1-D array containing N values.
Therefore, to resolve the issue, you may either:
  1. Go into the "MATLAB Function" block's code under the "FUNCTION" tab, then select "Edit Data". Select the output variable which is causing the error in the right-hand side tab and in the code. Open the "Advanced" drop-down menu and check the option to "Interpret output column vectors as one-dimensional data".
  2. Use a "Reshape" block with the "Output Dimensionality" parameter set to "1-D array" to define the [Nx1] matrix as a 1-D array.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgrammatic Model Editing についてさらに検索

製品

リリース

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by