Hey there, ive got some problems. I was rebuilding the example "Integrate C Functions Using Legacy Code Tool" and got some errors after "legacy_code('sfcn_cmex_generate', def);".
Here is my code:
—
doubleIt.c:
#include "doubleIt.h"
double doubleIt(double inVal)
{
return(2*inVal);
}
—
doubleIt.h:
#ifndef DOUBLEIT_H
#define DOUBLEIT_H
double doubleIt(double inVal);
#endif
—
Matlabcode:
def = legacy_code('initialize')
def.SourceFiles = ('doubleIt.c');
def.HeaderFiles = ('doubleIt.h');
def.SFunctionName = 'ex_sfun_doubleit';
def.OutputFcnSpec = 'double y1 = doubleIt(double u1)';
legacy_code('sfcn_cmex_generate', def);
—
Errors after typing "legacy_code('sfcn_cmex_generate', def)":
Error using lct_pValidateStructure (line 44) The field "HeaderFiles" is of class "char" and must be of class "cell"
Error in C:\Program Files\MATLAB\R2013a\toolbox\simulink\simulink\+legacycode\@LCT\LCT.p>LCT.LCT (line 43)
Error in C:\Program Files\MATLAB\R2013a\toolbox\simulink\simulink\+legacycode\@LCT\legacyCodeImpl.p>iCreateLctObject (line 171)
Error in C:\Program Files\MATLAB\R2013a\toolbox\simulink\simulink\+legacycode\@LCT\legacyCodeImpl.p>legacyCodeImpl (line 52)
Error in legacy_code (line 87) [varargout{1:nargout}] = legacycode.LCT.legacyCodeImpl(action, varargin{1:end});
—
How do i fix it? :X
Regards, Alex
Best Answer