CompiledPortWidths and CompiledPortDimensions are used from the command line to get the size and dimensions of signals in your model. They are queried using:
s = get_param(gcb,'CompiledPortWidths');
They are mostly the same, except that CompiledPortDimensions outputs a series of numbers denoting dimensions rather than an integer width (more details below). The output structure 's' from querying these properties has the form (for CompiledPortWidths):
s.Input = [vector of integer widths, one per input port]
s.Output = [vector of integer widths, one per output port]
s.State = [scalar integer width, since only 1 state port]
s.Enable = [scalar integer width]
s.Trigger= [scalar integer width]
(1) get_param(gcb,'CompiledPortWidths') can be invoked for any block, i.e., port blocks, virtual blocks (Mux, Demux, ...), etc.
(2) If gcb is a Trigger (Enable) block with an output port, the Output field of 's', i.e., s.Output, contains the output port width of Trigger (Enable) block.
(3) If gcb is a Trigger (Enable) block without output port 's' is empty.
(4) If gcb is a subsystem containing a Trigger (Enable) block (with or without output port), the Trigger (Enable) field of 's', i.e., s.Trigger (s.Enable), contains the width associated with the trigger (enable) port.
(5) 's' is an empty structure (0x0) if the get_param is executed
(i) before compiling the block diagram, or
(ii) after completing the simulation.
(6) If the InitFcn and StartFcn of gcb are set to get this parameter,
(i) InitFcn returns an empty structure,
(ii) StartFcn returns a non-empty structure.
(7) In the case of a bus signals with CompiledPortWidths,
(i) non-virtual buses are treated as 1x1 signals,
(ii) virtual buses are counted as the sum of the widths of their composite signals
(i) Each signal is given a value pair for its signals if it is one dimensional. If it is multidimensional, then it will list the number of dimensions, then the value of those dimensions. For example a 1x1 signal will be listed as [1 1], but a 2x4x5 signal will be listed as [3 2 4 5].
(ii) Virtual buses are listed in the format [-2 n s1 s2 s3 …] where n is the number of signals within the virtual bus and ‘s’ is the signals. For example, a virtual bus with two signals, one that is 1x1 and another that is 2x2x2, will be listed as [-2 2 1 1 3 2 2 2].
(iii) Nonvirtual buses are listed as [1 1].