Error using Simulink.S​imulationM​anager

18 ビュー (過去 30 日間)
Sahan Yoruc Selcuk
Sahan Yoruc Selcuk 2020 年 8 月 18 日
回答済み: Jyotsna Talluri 2020 年 8 月 25 日
I am trying to use the function generateSimulationEnsemble() to generate different simulation data for a Simulink (Simscape) model. However, I am always getting the following error: "Error using Simulink.SimulationManager SimulationInputs must be a nonempty array of Simulink.SimulationInput objects". The thing is my input simIn is not an empty array, it is an array of 1x4 with SimulationInput objects (as seen in the code below). I also tried running the examples given in the documentation: Generate and Use Simulated Data Ensemble and Using Simulink to Generate Fault Data. And I can run the example live script codes and the models without any problem, I can generate and store the data for different simulations. But in my code and model, I constantly get the error above. I checked my input simIn and it really is not empty. I really do not understand what I'm missing and it is getting a bit frustrating. Here is my code, base workspace and model:
% Open the model
model = "trialprj";
open_system(model)
% Generate the desired resistance values
res_val = 2:2:8;
% Generate the SimulationInput objects
for i = numel(res_val):-1:1
simIn(i) = Simulink.SimulationInput(model);
simIn(i) = setVariable(simIn(i), "resistance", res_val(i));
end
% Create the data storage directory
mkdir Data
disp("Directory created for storage")
location = fullfile(pwd, "Data");
% Generate simulation data
[status, E] = generateSimulationEnsemble(simIn, location);
  2 件のコメント
Jyotsna Talluri
Jyotsna Talluri 2020 年 8 月 24 日
Can you attach your model instead of sharing the screenshot?
Sahan Yoruc Selcuk
Sahan Yoruc Selcuk 2020 年 8 月 24 日
You can find the model in the attachments.

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

採用された回答

Jyotsna Talluri
Jyotsna Talluri 2020 年 8 月 25 日
The input ModelName to the Simulink.SimulationInput should be of type char and not string.
model = 'trialprj';

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePredictive Maintenance Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by