The key to finding the signal/port dimensions and types at the command line (i.e., via m-file) is to put your model into a "compiled" state before querying the dimensions/types. During the compile phase, signal/port dimensions and data types are propagated through the model. First, get your model into a compiled state (similar to a Ctrl+D or "Update Model" in Simulink):
>> myModel([],[],[],'compile')
For more information on this command, run the following command in MATLAB R2020b to access the documentation:
>> web(fullfile(docroot, 'simulink/slref/model_cmd.html'))
Once you have your model in a compiled state, you can query particular ports for their dimensions by following a workflow similar to this. To access the related documentation, use the following command in MATLAB R2020b:
>> web(fullfile(docroot, 'simulink/ug/determining-output-signal-dimensions.html'))
You can also access the port width and data type by using "get_param" with the following properties:
"CompiledPortDataType" "CompiledPortWidth"
An example code snippet (similar to the above-linked example) is below:
myModel([],[],[],'compile') q=get_param(gcb,'PortHandles'); get_param(q.Inport,'CompiledPortDataType') get_param(q.Inport,'CompiledPortWidth') myModel([],[],[],'term')
As the code snippet shows, once you finish querying your desired ports, make sure to move your model out of the compiled state and into the terminated state as:
>> myModel([],[],[],'term')
Please follow the link below to search for the required information regarding the current release: