How to search for a specific outport data type when set to Inherited ?
12 views (last 30 days)
Show older comments
Hi,
In my model, my Output data type are set to inherit. When i update diagram (ctrl + D), simulink display the data type.
I want to search for a specific data type into my entire model.
For exemple, how can i get all the "double" type that exists in my model without staying hours and hours looking into my model ?
Thx
0 Comments
Answers (1)
Kaustubha Govind
on 24 May 2013
I think you should be able to do this using the Simulink command-line API in a MATLAB script. You can use the following commands to get the full list of blocks in your model:
>> blockList = find_system('vdp', 'LookUnderMasks', 'all', 'type', 'block');
Then, compile your model:
>> vdp([], [], [], 'compile')
You can then loop over the blocks list and look at the compiled port datatypes and do something like this:
portDTs = get_param(blockList{i}, 'CompiledPortDataTypes');
hasDoubleOutput = any(cellfun(@(x)isequal(x, 'double'), portDTs.Outport));
Don't forget to terminate the model at the end:
>> vdp([], [], [], 'term')
0 Comments
See Also
Categories
Find more on Model, Block, and Port Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!