How to output all my Simulink model signals' Output data type?

Hi guys, My current project is to findout all the signals' output data type(int16, int32, single, double..). How can I do this? And can i output these information into .CSV file? Thank a lot~

 Accepted Answer

You can use the CompiledPortDataType property of block ports to get the port datatype.
outportBlks = find_system('modelname', 'BlockType', 'Outport');
outportDTs = cell(numel(outportBlks), 1);
modelname([],[],[],'compile')
for i = 1:numel(outportBlks)
outportBlk = outportBlks{i};
q=get_param(outportBlk,'PortHandles');
outportDTs{i} = get_param(q.Inport,'CompiledPortDataType');
end
modelname([],[],[],'term');
xlswrite('csvlist.dat',outportDTs);
I used xlswrite because it is the easiest way I could think of to write cell arrays out to a file (although it doesn't separate the strings will commas). You can of course choose one of the several techniques in MATLAB to write the variable outportDTs to a file.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!