필터 지우기
필터 지우기

How to pass a changing value from workspaces to Simulink?

조회 수: 1 (최근 30일)
Andrea Strappato
Andrea Strappato 2020년 5월 27일
댓글: zahra hosaini 2021년 9월 7일
Hi everyone,
I'm trying to pass a value from workspaces to Simulink calculated by Matlab step-by-step. This value changes each step, but the Simulink simulation take the first value and keep it costant. I'm using simin block and doesn't refresh data. How can I solve this issue?
  댓글 수: 1
Ameer Hamza
Ameer Hamza 2020년 5월 28일
How is value changing in base workspace? Are you running a loop which changes the value of the variable?

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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 28일
편집: Ameer Hamza 2020년 5월 28일
If the value is continually changing in the base workspace, you need to use MATLAB function block and evalin() to read the updated value at each time-step. See the attached file (saved in R2020a). It reads the value of variable 'x' from base-workspace.
  댓글 수: 3
Ameer Hamza
Ameer Hamza 2020년 5월 28일
I am glad to be of help!
zahra hosaini
zahra hosaini 2021년 9월 7일
OMG
this actualy works!
i have been looking for a week
thank you very much for the answer

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by