How to create a .mat file from the signal builder test scenario (data signals)

5 ビュー (過去 30 日間)
Gaya3
Gaya3 2014 年 1 月 31 日
回答済み: Anshuman 2024 年 10 月 24 日 10:42
Hi, I have created a set of test scenario's for a simulation model...I would like to automate it by writing a script... I want to know how to create a .mat file from the already created signal builder test scenario or is there any better option to automate signal builder test scenarios?
Any guidance you could provide me is highly appreciated!

回答 (1 件)

Anshuman
Anshuman 2024 年 10 月 24 日 10:42
Hello,
Automating test scenarios for a simulation model can be efficiently managed using MATLAB scripts. If you are using the Signal Builder block in Simulink, you can automate the test scenarios in the following ways:
You can use the "signalbuilder" function to control the Signal Builder block programmatically. This allows you to switch between scenarios, run simulations, and collect results without manual intervention.
load_system('your_model_name');
% Get the block handle
sbBlock = 'your_model_name/Signal Builder';
% Get the number of groups (scenarios)
numGroups = signalbuilder(sbBlock, 'get', 'groupnames');
for i = 1:length(numGroups)
% Set the active group
signalbuilder(sbBlock, 'activegroup', i);
% Run the simulation
simOut = sim('your_model_name');
end
close_system('your_model_name', 0);
Additionally , if you are using Simulink Test, consider creating test harnesses and using the Test Manager to manage and automate your test scenarios. This approach provides a more integrated environment for testing and results analysis.
Hope it helps!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by