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

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

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

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 Simulink 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!