This article discusses steps to build the experiment from scratch using DMAPI from Matlab without using Prescan GUI
Details
Steps 1: Using Matlab and DMAPI function we would start building the experiment. Start with creating new script with the below command
%Create Prescan experiment experiment = prescan.api.experiment.createExperiment(); %Give the experiment a name pbFile = 'CreateExpFromMatlab.pb'; %Save the experiment data model file experiment.saveToFile(pbFile);
Step 2: Add actors and sensor as required
%Add an actor to the experiment myRivianR1T1 = experiment.createObject(experiment.objectTypes.Rivian_R1T_1); Attach a camera to the actors myRivianR1TCam = prescan.api.camera.createCameraSensor(myRivianR1T);
%This command is just to retrieve the camera attached to the RivianR1T camsensorRivianR1T = prescan.api.camera.getAttachedCameraSensors(myRivianR1T);
%This command is just to retrieve the cameras used in the experiment camsensorExp = prescan.api.camera.getCameraSensors(experiment);
%Save the experiment datamodel experiment.saveToFile(pbFile); %Run the experiment prescan.api.simulink.run(experiment,'StopTime','10');