How to find MATLAB function blocks??

5 vues (au cours des 30 derniers jours)
TT DD
TT DD le 5 Juil 2021
Commenté : TT DD le 6 Juil 2021
Dear Community, can i get the answer to this question?
S = sfroot();
% Get block
handlesB = find(sfroot, '-isa','Stateflow.EMChart');
This is the instruction I have used to find out the MATLAB Function blocks. But, this instruction also considers the MATLAB Function block present the the Simulink library. I would like to know whether there is any other command to find out MATLAB Function blocks which are just present in my created Model.

Réponses (1)

Yongjian Feng
Yongjian Feng le 5 Juil 2021
Once you find the root of state flow using sfroot, you can use the find function as you used above. In addtion you can add a new name-value pair if you know the name of the block.
Something like
find(sfroot, '-isa', 'Stateflow.EMChart', 'Name', 'MyBlock');
  1 commentaire
TT DD
TT DD le 6 Juil 2021
Thank you so much for the answer. I have tried using these instructions as well, but it looks it doesnot work.
Using this instruction I am able to find the MATLAB function block. Although the issue is that it also gives the MATLAB function block when there is no MATLAB function block present in my model. I am surprised that, to which MATLAB function block is it referring to when there is no function block in the created model.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by