フィルターのクリア

initial position of vrml scene when run new simulation

1 回表示 (過去 30 日間)
enzo milito
enzo milito 2014 年 4 月 13 日
コメント済み: enzo milito 2014 年 4 月 26 日
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

採用された回答

Jan
Jan 2014 年 4 月 15 日
編集済み: Jan 2014 年 4 月 15 日
Hi Enzo,
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.
Hope this helps,
Jan
  2 件のコメント
enzo milito
enzo milito 2014 年 4 月 17 日
Thanks so much Jan, I think that this way is a right way Now I try to to do what you say, I think also that I need something other suggestion .....
thanks again
enzo milito
enzo milito 2014 年 4 月 26 日
thanks Jan , your suggestion is great, so it's possible to save the last position of vrml scene and open e new simulation from last position. Thanks so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by