Is it possible to integrate a vrml file with simulink and .m file simultaneously
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Jan Houska
2013년 8월 14일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!