How to send data to a embedded matlab fn block from simulink model

1 view (last 30 days)
lI've modelled a BLDC motor in time domain. In that i need to send data(current and voltage ) from motor block to an embedded matlab fn block for processing and output of the same is send back to model as afeed back. I want to get it while the model is running.Can any one help me with a solution I 've tried a lot
  1 Comment
Bassam Saleh
Bassam Saleh on 4 Sep 2015
i have almost the same issue
http://www.mathworks.com/matlabcentral/answers/239517-how-to-simulate-a-model-inside-an-embedded-matlab-function-block-with-code-have-a-for-loop

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 19 Oct 2013
Read this link http://www.mathworks.com/help/simulink/slref/matlabfunction.html, you can see an example. For your case you have two inputs and one output. Inside the Matlab Fcn block wwrite
function output=fcn(current,voltage)
%your code
Then you will see your block with two inputs a,d one output

More Answers (0)

Categories

Find more on Programmatic Model Editing 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!