simulink and m file connection

5 views (last 30 days)
mado
mado on 22 Mar 2013
Answered: Ramya on 6 Oct 2016
i have genetic algorithm written in m file and i want to run simulink from m file then read from simulink to m file the problem here is that i don't know how to read this value before the genetic algorithm running
  2 Comments
mado
mado on 22 Mar 2013
the result of m file will be used in simulink after m file finished its iteration

Sign in to comment.

Answers (4)

Azzi Abdelmalek
Azzi Abdelmalek on 22 Mar 2013
Edited: Azzi Abdelmalek on 22 Mar 2013
In simulink model use from workspace block to read data from workspace and to workspace block to export data to workspace
  6 Comments
mado
mado on 22 Mar 2013
Edited: mado on 22 Mar 2013
why ?could you explain my code is colmplex and it contain calling function

Sign in to comment.


Jason Ghidella
Jason Ghidella on 25 Mar 2013
What you need to do is use set_param end to set the values of Simulink parameters from the GA objective function, and have an outport on the signal you want to read in the GA onjective function. Then you run the Simulink model using the sim function, and then look at the simulation output to get the value.
This video shows how to do this:

mado
mado on 22 Mar 2013
for example if i used to workspace and i ran simulink the data won't be sent to workspace untill the simulink stopped

Ramya
Ramya on 6 Oct 2016
can anyone tell me how to use the optimised values from the m file in simulink?

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by