How to run simulink model from a function file?

조회 수: 1 (최근 30일)
Vishisht Bhaiya
Vishisht Bhaiya 2015년 11월 4일
댓글: Vishisht Bhaiya 2015년 11월 5일
Dear Researchers, I am running a function file to determinate some parameters to be used in a simulink model. Before the end of the function I am running my simulink using simout command. At this step all the parameters are deleted and simulink model is not running. In debugging,parameters are normally stored in a workplace until the the last line before the sim command. Why simOut command is deleting the previous results and how to fix it?

답변 (1개)

Stefan Raab
Stefan Raab 2015년 11월 4일
Hello, you have to specify which workspace the simulation should use. The default value is your base workspace, which is different from your function workspace. Try calling the simulation by:
simOut = sim('YOUR_MODEL','SrcWorkspace','current');
Kind regards, Stefan
  댓글 수: 1
Vishisht Bhaiya
Vishisht Bhaiya 2015년 11월 5일
Hello Stefan, I tried this but it doesn't work.

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

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by