put a .m file into the simulink ,why can't work?
Show older comments
I pulled a m function model and code as followed
function y = fcn(u1,u2)
coder.extrinsic('loadlibrary','libfunctions','calllib','unloadlibrary');
loadlibrary('DLL_ADD','DLL_ADD.h');
libfunctions DLL_ADD;
G=calllib('DLL_ADD','Add',u1,u2);
unloadlibrary('DLL_ADD');
y = G;
but there are some errors I can't figure out
Function output 'y' cannot be an mxArray in this context. Consider preinitializing the output variable with a known type.
Function 'MATLAB Function1' (#65.0.232), line 1, column 1:
"function y = fcn(u1,u2)"
Launch diagnostic report.
Errors occurred during parsing of MATLAB function 'MATLAB Function1'(#65)
Accepted Answer
More Answers (1)
pardis ghaziamin
on 2 Aug 2018
0 votes
function e = fcn(teta,p1,p2) %#codegen
p1=[x_r;y_r;teta_r]; p2=[x;y;teta];
e=[cos(teta),sin(teta),0;-sin(teta),cos(teta),0;0,0,1]*[(x_r)-x;(y_r)-y;(teta_r)-teta];
it has Launch diagnostic report. on x_r ,x
Categories
Find more on Simulink Functions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!