Access variables from workspace in Interpreted Matlab Function

조회 수: 1 (최근 30일)
Dhruv Thakkar
Dhruv Thakkar 2022년 6월 10일
댓글: Dhruv Thakkar 2022년 6월 18일
I have an Interpreted matlab function block in my simulink file which solves a MPC problem everytime it is called. I am using YALMIP and I wish to setup the 'optimizer' variable in a PostLoad Fcn, as setting it up at every time instant has huge overhead. I want to call the 'optimizer' variable in my interpreted matlab function block to solve the MPC problem. Intially I thought of creating a persistent variable and setting it up within the Interpreted function, but this would mean that it will take a long time before I can return my first control command, this will cause it to miss the deadline to produce the control command.
Is there a way in which I can call this variable from the workspace, in a manner similar to "Paramter Data" in normal Matlab function blocks?

채택된 답변

Johan Löfberg
Johan Löfberg 2022년 6월 17일
https://yalmip.github.io/YALMIP-and-simulink/ (with obvious change to do an initial call from work-space instead of setting up optimizer in first run at t=0)
  댓글 수: 1
Dhruv Thakkar
Dhruv Thakkar 2022년 6월 18일
I had actually seen this but didn't occur to me that I can simply call it rather than intializing it.
PS. Thank you for the toolbox, it is really helpful.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Plant Specification에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by