Error when loading external input data into root-level Inport

18 ビュー (過去 30 日間)
Maximilian Winkelmann
Maximilian Winkelmann 2021 年 10 月 27 日
編集済み: Maximilian Winkelmann 2021 年 11 月 5 日
Hello,
i am trying to load a 365x2 double (average temperature data for every day of the year) that has been imported from an excel file and is located in the base workspace. I am using two input ports to pass the parameter to a simulink system, a subsystem and into a matlab function in said subsystem. I specified the matrix dimensions of the input port as [rows colums] in the block parameters -> signal attributes -> Port dimensions: [365 2], but i get following error message:
"Error loading external input data into root-level Inport ModelTest/Input in model 'ModelTest'.
Caused by: When loading a matrix input, the blocks loading the corresponding data columns of the matrix must specify dimension using a scalar."
How am i supposed to specify a matrix dimension using a scalar?
Thanks for your help!

採用された回答

Fangjun Jiang
Fangjun Jiang 2021 年 10 月 29 日
Simulink model simulation has a "time" element. The true meaning of your data is that you want to input 2 scalar data. The number 365 indicates that you provide 365 days of data. The simulation could run for 30 days or 1000 days. The input data will not be fully used or interpolated after 365 days.
So the dimension of your data should be specified as 2. You also need to add the time vector. The first column is the time vector, the second and third column is your data. Make it one matrix and specify that at the configuration parameters, data import/export.
  1 件のコメント
Maximilian Winkelmann
Maximilian Winkelmann 2021 年 11 月 5 日
編集済み: Maximilian Winkelmann 2021 年 11 月 5 日
Hello and thank you for your answer!
I noticed the way i tried to do this is not the intended use-case of these blocks. I figured i could simply use 1-D Lookup Tables, in wich i use parts of the imported table for "table data" and "breakpoints". This works fine. Case closed :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by