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

8 views (last 30 days)
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

Kaustubha Govind
Kaustubha Govind on 1 Dec 2011
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)

Community Treasure Hunt

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

Start Hunting!