Error with simout = sim (...)

2 ビュー (過去 30 日間)
Tania Izquierdo
Tania Izquierdo 2016 年 11 月 14 日
回答済み: nick 2024 年 10 月 3 日
I have defined three signals with timeseries, then I want to simulate a model loading this three signals I have a error with the function simout = sim ('model', 'LoadExternalInput','on', 'ExternalInput','inp', 'ExternalInput','inp1','ExternalInput','inp2'); Error using model (line 41) The number of external inputs must be equal to the number of root-level input port blocks. Root-level input port blocks include Trigger and Enable blocks. The model contains 3 root-level input port blocks, but 1 external inputs were specified in Configuration Parameters -> Data Import/Export -> Input. I don't know why doesn't recognize the signals

回答 (1 件)

nick
nick 2024 年 10 月 3 日
Hi Tania,
The error is due to the way format of specifying external inputs for Simulink model. In MATLAB R2016, you can specify multiple external inputs as a single concatenated variable, as shown:
inputData = [timeVector, inp.Data, inp1.Data, inp2.Data];
simout = sim('model', 'LoadExternalInput', 'on', 'ExternalInput', 'inputData');
You can refer to 'Model Parameters' in Simulink to learn more about 'ExternalInput'. You can access the documentation using the following command in MATLAB Command window:
doc Model Parameters

カテゴリ

Help Center および File ExchangeSave Run-Time Data from Simulation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by