MATLAB Answers

How scenarios can be generated automatically

9 views (last 30 days)
In R2018b there was the helperScenarioReader.m and the mat-files generated by Driving Scenario Designer had a simple structure containing only matrices, so it was very easy to generate such mat files automatically.
But in R2019a the scenarioReader is p-coded and the mat-files generated by Driving Scenario Designer have a very complex structure containing class objects and it seems, that such class objects cannot be initialized outside the GUI of Driving Scenario Designer.
Any idea or solution to create such mat-files in R2019a automatically?


Sign in to comment.

Accepted Answer

Roshin Kadanna Pally
Roshin Kadanna Pally on 1 Oct 2019
Hi Thaddaus,
Starting from R2019b, the Scenario Reader can read from a drivingScenario object in MATLAB workspace. See the following page:
Hope this helps.


Show 2 older comments
Thaddäus Menzel
Thaddäus Menzel on 18 Nov 2019
Hello Muhammad,
save the designed scenario in the workspace and open the properties of the scenarioReader block of your Simulink-model. There you can link the workspace variable of your designed scenario.
"Import Modified Scenario into Simulink
To import the modified scenario into a Simulink model, use a Scenario Reader block. This block reads the roads and actors from either a scenario file saved from the app or a drivingScenario variable saved to the MATLAB workspace or the model workspace. Add a Scenario Reader block to your model and set these parameters.
1.Set Source of driving scenario to From workspace.
2.Set MATLAB or model workspace variable name to the name of the drivingScenario variable in your workspace."
Kind regards,
Muhammad Iqbal
Muhammad Iqbal on 2 Dec 2019
Thanks Thaddaus;
I got It ,but now i want to know about
1. "How to repeat/run the modified scenario 1000 time with simulation run ? "
e.g i have a piece of road as
scenario = drivingScenario;
roadCenters = [0 0; 50 0];
roadWidth = 6;
road(scenario, roadCenters, roadWidth);
how to repeate this 1000 with the model to get data from generated graph after simulation run?
Thaddäus Menzel
Thaddäus Menzel on 3 Dec 2019
for i=1:1000
% here the scenario or model can be modified
% here the results can be read
2) You have to mark and right click on the corresponding signal you want to read of the model and click on "Log Selected Signals". After simulation you can access all signals, which are logged and marked by an antenna.
After saving the model and simulation you can access the data by SignalName.Time and SignalName.Data.

Sign in to comment.

More Answers (0)

Sign in to answer this question.