Implementing custom MATLAB functions in Simulink -
i use custom matlab function in simulink. far have done placing embedded matlab function block. however, if custom function contains custom function compile process fails.
here example of function trying embed in simulation:
function [c, d, iterationscount] = decodeldpc(y, h, variance) lci = initializelq(y, h, variance); lr = getlr(lci); [lq, c] = getlq(lci, h, lr); iterationscount = 1; while(sum(mod(c * h', 2)) ~= 0) lr = getlr(lq); [lq, c] = getlq(lq, h, lr); iterationscount = iterationscount + 1; end; g = getgeneratormatrix(h); d = c/g;
where initializelq
, getlr
custom functions well.
is there method implement above function in simulation?
you need use command eml.extrinsic call external matlab functions eml block. example, can put @ top of eml function,
eml.extrinsic('getlr', 'initializelq');
to allow functions called. more information, see documentation
Comments
Post a Comment