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

29 次查看(过去 30 天)
松
2024-7-2,6:18
评论: 2024-7-17,3:48
simscapeで作成したモデルをコマンドから開き1ステップずつ進める方法がありましたら教えていただきたいです。よろしくお願いいたします。

采纳的回答

covao
covao 2024-7-6,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 个评论
松
2024-7-17,3:48
ありがとうございます.使用させていただきます.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simscape Multibody 的更多信息

标签

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!