MATLAB Answers

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

Asked by V Vaishnavi Kumar on 26 Nov 2012

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


1 Answer

Answer by Muruganandham Subramanian on 30 Nov 2012


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



  1 Comment

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,

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today