Using data struct in Simulink Embedded Matlab function
Show older comments
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
Answers (1)
Kaustubha Govind
on 5 May 2011
1 vote
You can work with structures in an (Embedded) MATLAB Function block using buses. See Working with Structures and Bus Signals.
2 Comments
Halit
on 15 Mar 2012
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
on 15 Mar 2012
Halit: Your question is unrelated to this posting. Please create a new question.
Categories
Find more on Stateflow in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!