How can a Script Read a resolved Data Type String?

1 次查看(过去 30 天)
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?

回答(1 个)

Aditya
Aditya 2016-7-27
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

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by