Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating "Bus Creator" & "Model Info" block using m-script !

156 views
Skip to first unread message

raj

unread,
Jan 29, 2011, 4:36:03 PM1/29/11
to
Hi All,
Can anyone please suggest me how to create "Bus Creator" & "Model Info" block using m-script ?
I am trying this:
add_block('built-in/Bus Creator','mysys/Outputs_Bus');
but getting following error::
??? There is no block named 'built-in/Bus Creator'.

Same error I am getting while adding "Model Info" block. Also I would like to update the "Model Info" block using m-script.

Thanks & Regards
R.

Phil Goddard

unread,
Jan 29, 2011, 8:02:03 PM1/29/11
to

The block type is BusCreator (without the space) so you need
>> add_block('built-in/BusCreator','mysys/Outputs_Bus');

The Model Info block isn't built-in (it's a subsystem with a mask on top of it), so you need to use a slightly different syntax

>> add_block('simulink/Model-Wide Utilities/Model Info','mysys/myNameName')

Phil.

raj

unread,
Feb 26, 2011, 10:41:07 AM2/26/11
to
Thanks Phil. One more help needed.
How to Update the Model Info block programmitacally? like Model Properties, %<ModelVersion>, Description etc.

Regards
R. S.

"Phil Goddard" <philN...@goddardconsulting.ca> wrote in message <ii2dab$saf$1...@fred.mathworks.com>...

Phil Goddard

unread,
Feb 27, 2011, 10:23:04 PM2/27/11
to

> How to Update the Model Info block programmitacally? like Model Properties, %<ModelVersion>, Description etc.

Assuming you mean how do you add new properties (rather than change the value of existing properties) then you can do the following:

Assume there is a model info block that already has Description and Model Version displayed, then
>> strExisting = get_param(gcb,'DisplayStringWithTags')
strExisting =
Model Info
%<Description>
%<ModelVersion>

Then is you want to add the Modified Date you'd create a new string
>> strNew = [strExisting,char(10),'%<ModifiedDate>']
strNew =
Model Info
%<Description>
%<ModelVersion>
%<ModifiedDate>

Note that char(10) is the ascii character for carriage return, and that strNew is a row Vector -- it is not a multi-row matrix.

Then to update the display
>> set_param(gcb,'DisplayStringWithTags',strNew); %Insert the new string
>> slcm('UpdateAllCMBlocksInThisModelInit') %Get the block to re-initialize

Phil.

raj

unread,
Mar 1, 2011, 8:21:21 AM3/1/11
to
Hi,
As You suggsted the following;

> >> add_block('simulink/Model-Wide Utilities/Model Info','mysys/myNameName')

I am trying to run this in different versions of MATLAB, but in one version 'simulink/Model-Wide Utilities/Model Info' is working while in another version 'Simulink/Model-Wide Utilities/Model Info' .
If you notice, the problem is with writing "Simulink" with either Caps "S" or small "s" in word "Simulink".
How to deal with this problem ?


"raj" wrote in message <ikb6uj$h5t$1...@fred.mathworks.com>...

0 new messages