m语言
参数
p = Simulink.Parameter;
p.Value.MaxIdx = [2 2];
p.Value.BP1 = [1 2 3];
p.Value.BP2 = [1 4 16];
p.Value.Table = [4 5 6; 16 19 20; 10 18 23];
p.DataType = 'Bus: slLookupTable';
p.CoderInfo.StorageClass = 'ExportedGlobal';
% Create bus object slBus1 from MATLAB structure
Simulink.Bus.createObject(p.Value);
slLookupTable = slBus1;
slLookupTable.Elements(1).DataType = 'uint32';
生成结构体如下:
信号
% struct for signal
Struct = Simulink.Bus;
BusElements{1}(1,1) = Simulink.BusElement;
BusElements{1}(1,1).Name = 'Value';
BusElements{1}(1,1).DataType = 'uint8';
BusElements{1}(2,1) = Simulink.BusElement;
BusElements{1}(2,1).Name = 'Status';
BusElements{1}(2,1).DataType = 'boolean';
BusElements{1}(3,1) = Simulink.BusElement;
BusElements{1}(3,1).Name = 'Stamp';
BusElements{1}(3,1).DataType = 'uint8';
Struct.Elements = BusElements{1};
Struct.DataScope = 'Exported';
%define signal datatype
s.DataType = 'Bus: Struct';
model explorer方法
to be continued