Getting 'empty' Compiled Port Data Types
16 views (last 30 days)
I'm trying to write a script to get datatypes of an inport and a outport of a subsytem/block. When I run following command:
an empty array/structure is returned. Model is compiled before running this command. 'CompiledPortDataDimensions' also returns an empty results.
Andy Bartlett on 7 Jul 2023
Edited: Andy Bartlett on 7 Jul 2023
Set model in compile mode to access data types
This may be changing, but historically at least, compiled port data types are available only when the model is actively in compiled mode.
mdl = 'fxpdemo_feedback';
% "Lock" model in compiled mode
% NOTE: you will not be able to edit or even close model
% until compiled mode is terminated !!!
% TIP: Use try catch to avoid being unwittingly stuck in compile mode
blk1 = 'fxpdemo_feedback/A2D';
pdt1 = get_param(blk1,'CompiledPortDataTypes');
blk2 = 'fxpdemo_feedback/Controller/Combine Terms';
pdt2 = get_param(blk2,'CompiledPortDataTypes');