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 个)

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

2 个评论

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?
Halit: Your question is unrelated to this posting. Please create a new question.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Stateflow 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by