Thread Subject: PLEASE HELP (3rd try)

Subject: PLEASE HELP (3rd try)

From: JuanMa

Date: 1 Jul, 2007 08:17:05

Message: 1 of 6

Hello,

Please!! Please!! Please!! I need help. I am starting to feel
frustrated. I have been trying to add programatically a existed
simulink model intro a library. But i didnt find the way how to do
it.

This is one my code but it doesnt work:

% Create a new library
lib = open_system(new_system('ssl','Library'));

% Load the block Model
model = load_system('model.mdl');

% Add Model intro the Library
add_block(getfullname(model), [getfullname(ssl) '/'
getfullname(model)])

Please somebody knows how to do it ?

Thanks in advances
JuanMa

Subject: PLEASE HELP (3rd try)

From: Titus

Date: 3 Jul, 2007 10:09:19

Message: 2 of 6

Hi Juan,

the call to add_block is not correct: you can not add
the model to a library, but a block from the model,
so you need to do something like
add_block([getfullname(model) '/MyBlockToAdd'], ...
  ['ssl/' getfullname(model)])

Titus

"JuanMa" <tingspain@gmail.com> schrieb im Newsbeitrag
news:ef5c2e3.-1@webcrossing.raydaftYaTP...
> Hello,
>
> Please!! Please!! Please!! I need help. I am starting to feel
> frustrated. I have been trying to add programatically a existed
> simulink model intro a library. But i didnt find the way how to do
> it.
>
> This is one my code but it doesnt work:
>
> % Create a new library
> lib = open_system(new_system('ssl','Library'));
>
> % Load the block Model
> model = load_system('model.mdl');
>
> % Add Model intro the Library
> add_block(getfullname(model), [getfullname(ssl) '/'
> getfullname(model)])
>
> Please somebody knows how to do it ?
>
> Thanks in advances
> JuanMa

Subject: PLEASE HELP (3rd try)

From: Juan Manuel Romero Martin

Date: 3 Jul, 2007 05:27:42

Message: 3 of 6

Titus wrote:
>
>
> Hi Juan,
>
> the call to add_block is not correct: you can not add
> the model to a library, but a block from the model,
> so you need to do something like
> add_block([getfullname(model) '/MyBlockToAdd'], ...
> ['ssl/' getfullname(model)])
>
> Titus
>

Hi Titus,

First of all, Thanks very much to answer. I really appreciated it.

Exactly, what i wanna do is to create a library (core.mdl)
dynamically. This core is just a interface to organize other
libraries that are stored in different folder. So the users can
easily access to them. I got how to create dynamically the core.mdl,
and i thinks it is working more and less right. However, I don't know
how to add into the core a block (in this case Subsystem Block that
is stored in a mdl file) as a reference not as copy. It works if i
drag and drop it from, let say, act1.mdl to the core.mdl. [act1.mdl
is a library not a model, because i found that the model can not be
referenced]. Please I don't know if i explain myself clear enough. My
English is a little bit rusty. Please, if you don't understand what i
am trying to do, ask. And I will try to explain myself again.
 

What i wanna do exactly is to have a system in which i modify
act1.mdl, and the change can be reflected in the core.mdl. So I can
modified individually each file and the changes appear on the
core.mdl.

Thanks in advances,
JuanMa

Subject: PLEASE HELP (3rd try)

From: Titus

Date: 3 Jul, 2007 12:03:42

Message: 4 of 6

Hi Juan,

when you add a block from a library to a model, it will always
be a reference, not a copy, as long as you don't break the
link.
Let's say your subsystem in act1.mdl is called subJuan.
Then the call should be
add_block('act1/subJuan', 'core/subJuan')
and then you should see, that subJuan in core.mdl is a link
to your block subJuan in act1.

Titus


"Juan Manuel Romero Martin" <tingspain@gmail.com> schrieb im Newsbeitrag
news:ef5c2e3.1@webcrossing.raydaftYaTP...
> Titus wrote:
>>
>>
>> Hi Juan,
>>
>> the call to add_block is not correct: you can not add
>> the model to a library, but a block from the model,
>> so you need to do something like
>> add_block([getfullname(model) '/MyBlockToAdd'], ...
>> ['ssl/' getfullname(model)])
>>
>> Titus
>>
>
> Hi Titus,
>
> First of all, Thanks very much to answer. I really appreciated it.
>
> Exactly, what i wanna do is to create a library (core.mdl)
> dynamically. This core is just a interface to organize other
> libraries that are stored in different folder. So the users can
> easily access to them. I got how to create dynamically the core.mdl,
> and i thinks it is working more and less right. However, I don't know
> how to add into the core a block (in this case Subsystem Block that
> is stored in a mdl file) as a reference not as copy. It works if i
> drag and drop it from, let say, act1.mdl to the core.mdl. [act1.mdl
> is a library not a model, because i found that the model can not be
> referenced]. Please I don't know if i explain myself clear enough. My
> English is a little bit rusty. Please, if you don't understand what i
> am trying to do, ask. And I will try to explain myself again.
>
>
> What i wanna do exactly is to have a system in which i modify
> act1.mdl, and the change can be reflected in the core.mdl. So I can
> modified individually each file and the changes appear on the
> core.mdl.
>
> Thanks in advances,
> JuanMa

Subject: PLEASE HELP (3rd try)

From: Juan Manuel Romero Martin

Date: 3 Jul, 2007 06:28:40

Message: 5 of 6

Hi Titus,

But this is the problem, i wanna copy a few libraries into a core
library (keeping the references) to make an organized library. So in
that way, the users have all the libraries centralized and organized
in a core one (interface). But the problem is that using add_block I
loose the references between the core and the other libraries that I
added into the core. Are you getting now what i am trying to do? HeHe
really I would like to apologize. I am sometimes a little bit messy
explaining myself.

Juan
 

Titus wrote:
>
>
> Hi Juan,
>
> when you add a block from a library to a model, it will always
> be a reference, not a copy, as long as you don't break the
> link.
> Let's say your subsystem in act1.mdl is called subJuan.
> Then the call should be
> add_block('act1/subJuan', 'core/subJuan')
> and then you should see, that subJuan in core.mdl is a link
> to your block subJuan in act1.
>
> Titus
>
>
> "Juan Manuel Romero Martin" <tingspain@gmail.com> schrieb im
> Newsbeitrag
> news:ef5c2e3.1@webcrossing.raydaftYaTP...
>> Titus wrote:
>>>
>>>
>>> Hi Juan,
>>>
>>> the call to add_block is not correct: you can not add
>>> the model to a library, but a block from the model,
>>> so you need to do something like
>>> add_block([getfullname(model) '/MyBlockToAdd'], ...
>>> ['ssl/' getfullname(model)])
>>>
>>> Titus
>>>
>>
>> Hi Titus,
>>
>> First of all, Thanks very much to answer. I really appreciated
> it.
>>
>> Exactly, what i wanna do is to create a library (core.mdl)
>> dynamically. This core is just a interface to organize other
>> libraries that are stored in different folder. So the users can
>> easily access to them. I got how to create dynamically the
> core.mdl,
>> and i thinks it is working more and less right. However, I
don't
> know
>> how to add into the core a block (in this case Subsystem Block
> that
>> is stored in a mdl file) as a reference not as copy. It works
if
> i
>> drag and drop it from, let say, act1.mdl to the core.mdl.
> [act1.mdl
>> is a library not a model, because i found that the model can
not
> be
>> referenced]. Please I don't know if i explain myself clear
> enough. My
>> English is a little bit rusty. Please, if you don't understand
> what i
>> am trying to do, ask. And I will try to explain myself again.
>>
>>
>> What i wanna do exactly is to have a system in which i modify
>> act1.mdl, and the change can be reflected in the core.mdl. So I
> can
>> modified individually each file and the changes appear on the
>> core.mdl.
>>
>> Thanks in advances,
>> JuanMa
>
>
>

Subject: PLEASE HELP (3rd try)

From: Titus

Date: 3 Jul, 2007 12:43:38

Message: 6 of 6

Hi Juan,

I would suggest then a hierarchical library, which makes things
easier:
- add an empty subsystem to core.mdl
- right click->Block properties
- go to "Callbacks" tab
- enter "act1" at OpenFcn

Now when you double click on the subsystem you will open
the act1 library.

Otherwise: what I suggested, works indeed. I made two libraries
(core and act1), added some block "MyGain" to act1, and used
add_block('act1/MyGain','core/MyGain')

to copy the block to core. This is no copy but a reference! And
when I drag that block from core to my testmodel, the reference
to act1 is still valid...

Titus


"Juan Manuel Romero Martin" <tingspain@gmail.com> schrieb im Newsbeitrag
news:ef5c2e3.3@webcrossing.raydaftYaTP...
> Hi Titus,
>
> But this is the problem, i wanna copy a few libraries into a core
> library (keeping the references) to make an organized library. So in
> that way, the users have all the libraries centralized and organized
> in a core one (interface). But the problem is that using add_block I
> loose the references between the core and the other libraries that I
> added into the core. Are you getting now what i am trying to do? HeHe
> really I would like to apologize. I am sometimes a little bit messy
> explaining myself.
>
> Juan
>
>
> Titus wrote:
>>
>>
>> Hi Juan,
>>
>> when you add a block from a library to a model, it will always
>> be a reference, not a copy, as long as you don't break the
>> link.
>> Let's say your subsystem in act1.mdl is called subJuan.
>> Then the call should be
>> add_block('act1/subJuan', 'core/subJuan')
>> and then you should see, that subJuan in core.mdl is a link
>> to your block subJuan in act1.
>>
>> Titus
>>
>>
>> "Juan Manuel Romero Martin" <tingspain@gmail.com> schrieb im
>> Newsbeitrag
>> news:ef5c2e3.1@webcrossing.raydaftYaTP...
>>> Titus wrote:
>>>>
>>>>
>>>> Hi Juan,
>>>>
>>>> the call to add_block is not correct: you can not add
>>>> the model to a library, but a block from the model,
>>>> so you need to do something like
>>>> add_block([getfullname(model) '/MyBlockToAdd'], ...
>>>> ['ssl/' getfullname(model)])
>>>>
>>>> Titus
>>>>
>>>
>>> Hi Titus,
>>>
>>> First of all, Thanks very much to answer. I really appreciated
>> it.
>>>
>>> Exactly, what i wanna do is to create a library (core.mdl)
>>> dynamically. This core is just a interface to organize other
>>> libraries that are stored in different folder. So the users can
>>> easily access to them. I got how to create dynamically the
>> core.mdl,
>>> and i thinks it is working more and less right. However, I
> don't
>> know
>>> how to add into the core a block (in this case Subsystem Block
>> that
>>> is stored in a mdl file) as a reference not as copy. It works
> if
>> i
>>> drag and drop it from, let say, act1.mdl to the core.mdl.
>> [act1.mdl
>>> is a library not a model, because i found that the model can
> not
>> be
>>> referenced]. Please I don't know if i explain myself clear
>> enough. My
>>> English is a little bit rusty. Please, if you don't understand
>> what i
>>> am trying to do, ask. And I will try to explain myself again.
>>>
>>>
>>> What i wanna do exactly is to have a system in which i modify
>>> act1.mdl, and the change can be reflected in the core.mdl. So I
>> can
>>> modified individually each file and the changes appear on the
>>> core.mdl.
>>>
>>> Thanks in advances,
>>> JuanMa
>>
>>
>>

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
simulink John D'Errico 3 Jul, 2007 12:36:44
rssFeed for this Thread

Contact us at files@mathworks.com