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

Simulink duplicate data logging

888 views
Skip to first unread message

Paul Schulten

unread,
Aug 22, 2003, 3:39:00 AM8/22/03
to
I have created (simulink)library block that includes a 'to workspace'
block. If I copy this library block in a model twice, the error
message 'duplicate data logging' appears since there are two 'to
workspace' blocks with the same variable.


How can I prevent this without manually changing the variable name
(my library block has about 50 'to workspace' blocks).


Regards,


Paul

Cole Stephens

unread,
Aug 22, 2003, 11:04:54 AM8/22/03
to
Mask the subsystem & have the "to workspace" variable as a parameter.

-C


"Paul Schulten" <p.j.m.s...@kim.nl> wrote in message
news:eec2a...@WebX.raydaftYaTP...

Steve Conahan

unread,
Aug 22, 2003, 11:08:48 AM8/22/03
to
Hi Paul,

You may need to write an M function in order to do this (to change the
variable name of the To Workspace logging variable underneath the subsystem
block implementation when your block is copied). One way is to parse the
name of the variable and add a number to it. The get_param function on the
block handle (using gcbh) under the subsystem and string manipulation in M
should do it.

After you have an M file that will do this, then you need to set your
subsystem block's 'CopyFcn' parameter to that M function name so that it can
be called when the block is copied. To do this, open your library, unlock
the library, select your subsystem block, set your library block's CopyFcn
parameter using the following on the M command line:

library_block_handle = gcbh;
set_param(library_block_handle,'CopyFcn','your_m_function_name')

Then re-save the library...

Cheers,
Steve

"Paul Schulten" <p.j.m.s...@kim.nl> wrote in message
news:eec2a...@WebX.raydaftYaTP...

Erik-Jan Boonen

unread,
Jun 30, 2010, 4:57:04 AM6/30/10
to
"Steve Conahan" <scon...@mathworks.com> wrote in message <bi5bm0$hmj$1...@fred.mathworks.com>...

> Hi Paul,
>
> You may need to write an M function in order to do this (to change the
> variable name of the To Workspace logging variable underneath the subsystem
> block implementation when your block is copied). One way is to parse the
> name of the variable and add a number to it. The get_param function on the
> block handle (using gcbh) under the subsystem and string manipulation in M
> should do it.
>
> After you have an M file that will do this, then you need to set your
> subsystem block's 'CopyFcn' parameter to that M function name so that it can
> be called when the block is copied. To do this, open your library, unlock
> the library, select your subsystem block, set your library block's CopyFcn
> parameter using the following on the M command line:
>
> library_block_handle = gcbh;
> set_param(library_block_handle,'CopyFcn','your_m_function_name')
>
> Then re-save the library...
>
> Cheers,
> Steve

Hello,

Can someone explain this further I am not able to write the M function/code.

I made a test model with the name "test". Added a masked subsystem (name DE_B_1) with 3 To Workspace blocks underneath. Now I would like that the parameter/variable names of the To Workspace blocks change when I copy the masked subsystem, which is named automatically to DE_B_2. The To Workspace variables are named like data_A_1. So after the copy I would like to see that the To Workspace variable is named data_A_2.

Regards,

Erik-Jan

0 new messages