Search code examples
matlabsimulink

How can I get signal dimensions in Simulink model


I have a question.

After simulate a simulink model I need to get signal dimensions of each line using MATLAB command.

I get line handles by following

line_h = find_system(gcs, 'FindAll', 'on','SearchDepth', 1, 'Type', 'Line')

then how can I get signal dimensions from line handles

** When check 'signal dimensions' in Format menu -> Port/Signal Displays After simulate a model number of signal dimensions will show on nonscalar line. I need to get it using MATLAB command.

Sorry for my English skill

Thank you


Solution

  • If you have a set of line handles from your find_system command you can use the following command to get the block connected to the signal.

    hblkSrc = get_param(h(k),'SrcBlockHandle');
    

    You can then use get_param(hblkSrc,'CompiledPortDimensions') as suggested by am304 to get the dimensions.