Question
I am using a simulink model to control a transform node of a .wrl file (using vr sink). Along with that I want to display the path traversed by the object(same transform node) using pointSet node. Since the points are generated using the simulink model dynamically, I planned to use a .m file to access transform nodes current position and pass it to the coordinate node of pointSet node. But I found that I am not able to simultaneously access the file(.wrl) from both simulink as well as .m file(maybe because it might create a memory lock situation though i am not writing same variables at both the places). Kindly provide an answer. If my approach is completely wrong, please tell me an alternative approach to display path traversed by an object when the object is controlled using a simulink model.
Expert Answer
Neeta Dsouza
PhD Expert
Answered Aug 26, 2026
You should be able to access a single virtual world simultaneously from both MATLAB and Simulink. If you get any errors, this is probably a problem with your code
The following code illustrates how to do a task very similar to yours, using a shipping example:
% open and start an example model
vrbounce
set_param(gcs, 'SimulationCommand', 'start');
% open the virtual world in MATLAB
w = vrworld('vrbounce.wrl');
open(w);
% read a value being changed by the running Simulink model
for i=1:10;
w.Ball.translation
pause(0.1);
end
% clean up
set_param(gcs, 'SimulationCommand', 'stop');
close(w);
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 →