Using data struct in Simulink Embedded Matlab function

I have the following goal:
Path following of a car by feedback control. The path waypoints are generated in Matlab. I would like to use Simulink to simulate the cars behavior under different feedback control strategies.
As the car moves along the path the setpoint for the feedback control requires knoledge of the coordinates of the "next" waypoint.
So my question:
1. How do I make a struct containing waypoint data (sitting in my workspace) available from within the Embedded MATLAB function?
2. Can I change given struct from within the Embedded MATLAB function (e.g. mark which waypoints already passed to know which one the "next" waypoint is)
3. Is this something I should/could do with stateflow?
Thanks in advance for any useful answers.
J

回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2011 年 5 月 5 日

1 投票

You can work with structures in an (Embedded) MATLAB Function block using buses. See Working with Structures and Bus Signals.

2 件のコメント

Halit
Halit 2012 年 3 月 15 日
Hi..I have system in simulink,in my system I control and optimize my pıd parameter ki,kp,kd with particle swarm optimization..I have pso matlab .mfile for pıd controller..I want to use pso .mfile for optimize my pıd in simulink.But I dont know How it work..Do I use embedded function sımulınk block? and How I use embedded simulink block..I make an very simple example embedded sımulınk block and it gives error.Could you help me?
Kaustubha Govind
Kaustubha Govind 2012 年 3 月 15 日
Halit: Your question is unrelated to this posting. Please create a new question.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeStateflow についてさらに検索

質問済み:

2011 年 5 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by