Problems with adding block from target link into a model

18 vues (au cours des 30 derniers jours)
Patrik
Patrik le 16 Juin 2011
Hi
I’m trying to add a block from the library TargetLink with the command: "add_block('tllib/Constant','mysys/nameofconstant','Position',[]).
But Matlab answers with:"??? Error using ==> add_block There is no block named 'tllib/Constant'.".
But if there already exist a model in the same folder containing a TargetLink block, then Matlab has no problem executing the command.
Do anyone have a idea how to fix this problem or how to make a work around.
//Patrik

Réponse acceptée

Arnaud Miege
Arnaud Miege le 16 Juin 2011
You maybe need to load the library before using add_block:
load_system('tllib');
add_block('tllib/Constant','mysys/nameofconstant','Position',[]);
HTH,
Arnaud

Plus de réponses (2)

Fangjun Jiang
Fangjun Jiang le 16 Juin 2011
Yep, this happens. What you need to do is to make sure that 'tllib' is loaded first. You can use load_system('tllib');

Patrik
Patrik le 16 Juin 2011
Thanks a lot! It works now. I have been looking for a solution for two hours, next time I will post a question hear earlier.
//Patrik

Catégories

En savoir plus sur Configure and View Diagnostics 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