How can i force simulink to use a set of data from another simulink model ?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hey,
I have a Simulink File, which generates some Data and exports it to my Workspace. My second Simulink file needs this data and therefore imports it. This also works wonderfully when I run each individual simulation myself. But now I want everything to run automatically with one click. So first simulation1 -> data is loaded -> simulation2 runs.
I have already tried it with the following code:
set_param('simulation1', SimulationCommand', 'start');
data_simulation2 = data_simulation1 + offset;
set_param('simulation2', SimulationCommand','start');
But the problem is that both simulations run, but the data is not transferred to the second simulation. Only after the second simulation is finished, the data is loaded.
LG
Lindrit
댓글 수: 0
채택된 답변
Paul
2022년 4월 17일
Try using the sim() command instead of set_param. I had trouble with the latter, but no problems with the former. This code worked fine for me, where y1 is a ToWorkspace output from sim1 and u2 is block paramter in sim2.
clear
out1 = sim('sim1');
u2 = out1.y1.Data;
out2 = sim('sim2');
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!