Clear Filters
Clear Filters

simscapeで作​成したモデルをコマン​ドから1ステップずつ​実行する方法について

29 views (last 30 days)
松
on 2 Jul 2024 at 6:18
Commented: on 17 Jul 2024 at 3:48
simscapeで作成したモデルをコマンドから開き1ステップずつ進める方法がありましたら教えていただきたいです。よろしくお願いいたします。

Accepted Answer

covao
covao on 6 Jul 2024 at 2:16
SimscapeやSimulinkのモデルは、MATLABコマンドでステップ実行することができます。
Simulinkの実行コマンドは以下に情報があります。
以下は、Simulinkモデルをステップ実行するスクリプト例です。
コードの作成に生成AIを用いています。
% Open the model
openExample('simulink_general/sldemo_bounceExample')
% Start the simulation
set_param(bdroot, 'SimulationCommand', 'start');
set_param(bdroot, 'SimulationCommand', 'pause');
% Advance one step
set_param(bdroot, 'SimulationCommand', 'step');
% % Advance multiple steps as needed
for i = 1:5
set_param(bdroot, 'SimulationCommand', 'step');
pause(1); % Pause for 1 second
end
% Stop the simulation
set_param(bdroot, 'SimulationCommand', 'stop');
  1 Comment
松
on 17 Jul 2024 at 3:48
ありがとうございます.使用させていただきます.

Sign in to comment.

More Answers (0)

Categories

Find more on Simscape Multibody in Help Center and File Exchange

Tags

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!