How to search for a specific outport data type when set to Inherited ?
Afficher commentaires plus anciens
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
Réponses (1)
Kaustubha Govind
le 24 Mai 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')
Catégories
En savoir plus sur Model, Block, and Port Callbacks dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!