How can a Script Read a resolved Data Type String?

1 view (last 30 days)
Jeremy
Jeremy on 11 Oct 2013
Answered: Aditya on 27 Jul 2016
I need to have my m-script read the data types of several blocks and labeled signals in a Simulink model, immediately after the model has been run. Many of these data types are not available in the "OutDataTypeStr" property. For example, I see one inport whose "OutDataTypeStr" value is set to "inherit: auto", but because I selected "Format - Port/Signal Displays - Port Data Types", when I run the model I see the correct name of the custom data type apear above the inport block's output signal. I can see it on my screen, but I cannot figure out how to read it in an M-script. Any suggestions?

Answers (1)

Aditya
Aditya on 27 Jul 2016
You need to be in compiled mode for this.
Say your full block path is stored in the variable blockPath Note: The full block path can be obtained using the command gcb after a block is selected in the Simulink model.
>> blockObject = get_param(blockPath, 'Object');
>> blockObject.CompiledPortDataTypes % will give you what you want

Categories

Find more on Interactive Model Editing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!