How to use set_param correctly in a function

조회 수: 2 (최근 30일)
A
A 2021년 9월 1일
댓글: Walter Roberson 2021년 9월 6일
When I execute the following program in a function, each process can be performed, but the data in the To workspace is not reflected in the base workspace.
What is the difference between this and script execution?
Also, is there a way to solve this problem?
set_param('vdp','SimulationCommand','pause')
set_param('vdp','SimulationCommand','continue')

채택된 답변

Walter Roberson
Walter Roberson 2021년 9월 1일
The To Workspace block typically writes data to the MATLAB® base workspace. For a sim command in a MATLAB function, the To Workspace block sends data to the workspace of the calling function, not to the MATLAB base workspace. To send the logged data to the base workspace, use an assignin command in the function.
  댓글 수: 4
A
A 2021년 9월 6일
Is there a way to pause/stop Simulink that I can run within a function?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by