Is it possible to integrate a vrml file with simulink and .m file simultaneously
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Jan Houska
on 14 Aug 2013
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);
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!