Question
Hi all when i run simulation in my simulink model whit vrml scene, I have a certain position of my vrml scene, when run a new simulation I need that the vrml scene have initial position as the the final position of last simulation but this does not happen. Anyone have a suggestion to resolve this? thanks
Expert Answer
Prashant Kumar
PhD Expert
Answered Nov 20, 2025
In order to achieve the same initial conditions in each simulation run, virtual world is always re-loaded from the associated VRML file at the beginning of simulation.
If you need to start the next simulation where the previous has ended, you shall save the values of the object properties to the VRML file.
At some suitable place (StopFcn callback etc.) put something like this:
% extract model name model_name = bdroot(gcs); % Here we assume that you have the VR Sink block under its original name in % the model % get the handle to the virtual world associated with the VR Sink wh = vrworld(get_param([model_name '/VR Sink'], 'WorldFileName')); % save the current status of the virtual world to the file associated % with the VR Sink save(wh, get(wh,'FileName'));
Of course, in order to preserve the initial status of your scene, you should backup your original VRML file and arrange copying it to your working scene, when you want to start the simulation with initial status.
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related vrml Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →