How to send data from while loop during each iteration to simulink sub system model

2 views (last 30 days)
I am having a while loop in Particle swarm optimization controller (written in embedded matlab code). The controller should send an updated data to the simulink sub system. this updation is done by iterating while loop. Until the while loop finishes i couldnt send the data, I tried with eliminating while loop, but the optimization program has to be iterated some way

Answers (1)

Muruganandham Subramanian
Muruganandham Subramanian on 30 Nov 2012
while(....)
for (...)
pbest=[...] %no.of data depends on population
gbest=[] %one globally best data
sim('ur model name') %here you can call your simulink model to run by giving input from your global dtata
end
end
  1 Comment
V Vaishnavi Kumar
V Vaishnavi Kumar on 31 Dec 2012
K Sr i ll try, while sending data from that
sim('model name')
,will the embedded block receive data from other model,
Here all the blocks are in single simulink model, plz clear me will the embedded block send signal data to subsystem using same command,
how model name for subsystem could be given,

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!