Add simscape blocks programmatically

8 vues (au cours des 30 derniers jours)
Grzegorz Diaczek
Grzegorz Diaczek le 20 Déc 2022
Commenté : Mana le 21 Fév 2025 à 21:53
Hello,
I tried to add a simscape block programmatically, using 'add_block()' function.
add_block('Simscape/Foundation Library/Electrical/Electrical Sources/Controlled Current Source',[gcb,'/Current Load'])
The following error occured:
There is no block named 'Simscape/Foundation Library/Electrical/Electrical Sources/Controlled Current Source'
I check if there is no mistake in path definition, also the simulink and simscape has been loaded using 'load_system()' function. Using simple command to built-in library works fine:
add_block('built-in/Gain',[gcb,'/Current Load'])
Thanks for help.
  1 commentaire
Mana
Mana le 21 Fév 2025 à 21:53
I have the same problem and have not found a solution. I am interested if you know the solutions.

Connectez-vous pour commenter.

Réponses (1)

Chetan Bhavsar
Chetan Bhavsar le 20 Déc 2022
  1 commentaire
Grzegorz Diaczek
Grzegorz Diaczek le 20 Déc 2022
Thank you for your answer. Unfortunately, the output of gcb when block is right clicked in Library Browser is empty.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by