www.gusucode.com > rtwdemos 工具箱matlab源码程序 > rtwdemos/crl_demo/crl_table_lookup1D.m
function hLib = crl_table_lookup1D srcFilePath = fullfile(matlabroot, 'toolbox', 'rtw', 'rtwdemos', 'crl_demo'); hLib = RTW.TflTable; %---------- entry: lookup1D ----------- hEnt = RTW.TflCFunctionEntry; hEnt.setTflCFunctionEntryParameters( ... 'Key', 'lookup1D', ... 'Priority', 100, ... 'ImplementationName', 'my_Lookup1D_Repl', ... 'ImplementationHeaderFile', 'myLookup1D.h', ... 'ImplementationSourceFile', 'myLookup1D.c', ... 'ImplementationHeaderPath', srcFilePath, ... 'ImplementationSourcePath', srcFilePath); % Conceptual Args arg = hEnt.getTflArgFromString('y1','double'); arg.IOType = 'RTW_IO_OUTPUT'; hEnt.addConceptualArg(arg); arg = hEnt.getTflArgFromString('u1','double'); hEnt.addConceptualArg(arg); arg = RTW.TflArgMatrix('u2', 'RTW_IO_INPUT', 'double'); arg.DimRange = [0 0; Inf Inf]; hEnt.addConceptualArg(arg); arg = RTW.TflArgMatrix('u3', 'RTW_IO_INPUT', 'double'); arg.DimRange = [0 0; Inf Inf]; hEnt.addConceptualArg(arg); arg = hEnt.getTflArgFromString('u4','uint32'); hEnt.addConceptualArg(arg); % Algorithm Parameters hEnt.addAlgorithmProperty('ExtrapMethod',{'Clip'}); hEnt.addAlgorithmProperty('IndexSearchMethod',{'Linear search'}); hEnt.addAlgorithmProperty('InterpMethod',{'Linear'}); hEnt.addAlgorithmProperty('RemoveProtectionInput',{'off'}); hEnt.addAlgorithmProperty('RndMeth',{'Round'}); hEnt.addAlgorithmProperty('SaturateOnIntegerOverflow',{'off'}); hEnt.addAlgorithmProperty('SupportTunableTableSize',{'off'}); hEnt.addAlgorithmProperty('UseLastTableValue',{'on'}); % Implementation Args arg = hEnt.getTflArgFromString('y1','double'); arg.IOType = 'RTW_IO_OUTPUT'; hEnt.Implementation.setReturn(arg); arg = hEnt.getTflArgFromString('u1','double'); hEnt.Implementation.addArgument(arg); arg = hEnt.getTflArgFromString('u2','double*'); arg.Type.BaseType.ReadOnly = true; hEnt.Implementation.addArgument(arg); arg = hEnt.getTflArgFromString('u3','double*'); arg.Type.BaseType.ReadOnly = true; hEnt.Implementation.addArgument(arg); arg = hEnt.getTflArgFromString('u4','uint32'); hEnt.Implementation.addArgument(arg); hLib.addEntry( hEnt );