フィルターのクリア

S-Function - share complex variable between method functions

1 回表示 (過去 30 日間)
alex pabouctsidis
alex pabouctsidis 2013 年 5 月 15 日
Hello,
I'm trying to implement an MPC controller in simulink using Yalmip.
I'm a bit stuck because i need to pass a complex (non-default type) variable / object between the Start function, which initializes the optimization object, and the Output function which then computes the controller command using the optimizer object.
Is there any method to pass variables / objects between functions? I don't think i can use the s-function states due to the variable type.
Thanks, Alex

回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2013 年 5 月 15 日
If you are writing a C-MEX S-function, you can do this using a PWork vector. Please see the following links for help:
If you are writing a Level-2 MATLAB S-function, this is not very straightforward, but I explained here how you can use the block's UserData to achieve this.

製品

Community Treasure Hunt

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

Start Hunting!

Translated by