Simulink : Get handle of a Matlab-Function block, inside Matlab-Function itself

2 vues (au cours des 30 derniers jours)
Hello,
Is there a way to get handle of a Matlab-Function Simulink block inside of the Matlab-Function itself?
Thanks!

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 20 Fév 2020
I would think so, just try handle=get_param(Block,'handle') where "Block" is the full path of the MATLAB function block in your Simulink model.
  3 commentaires
Fangjun Jiang
Fangjun Jiang le 20 Fév 2020
would you try to see if "gcb" could always give you the correct path?
langrg
langrg le 21 Fév 2020
It works! I thougth that 'gcb' would change each time I select a bloc in Simulink, but in fact when it's used in Matlab-Function it always gives back Matlab-Function path.
I'm going to accept your answer and write solution in capital here:
USE "gcb" IS THE GOOD SOLUTION!
Thank you very much!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by