DSPRelated.com
Forums

simulink S-function parameter input from a signal in the system(subsystem)

Started by mary guo March 11, 2003
Hi,

In simulink I have a system established. I also created some s-functions for the
system. These s-functions all have parameters to enter. And they have shared
parameters as well. For the parameters unique to each s-function, I can enter
the paramter values from the s-function block parameter dialog box. But for the
shared parameters, I wanted to update only one place and have all the
s-functions involved get updates automatically.

One way to do this is to change the shared parameters to input signals and they
go to each s-function block that needs it. But what if I want to keep it as
parameter, Is there an alternative way?

Is it possible that I use the same variable name from the mask workspace and
somehow link the mask workspace with an constant output from the system?

Thanks.

Mary



Hi,
I can think of the follg ways. You might have tried
some of these methods.

1. Since it is a dialog box you can always enter a
variable name defined in Matlab workspace and enter
the same variable name wherever the parameter is
required. You can change the value in the workspace.

2. If all the blocks can be put under one subsystem
then you can mask the subsystem and then use the mask
variable in the blocks under it.

3. Mask just one block and have a callback associated
with the shared parameters, in which you can do
set_param on all other shared locations.

4. Similar to above create an empty subsystem (called
parameters) and then create a mask with all shared
parameters in it. Write a callback which then updates
the blocks in the model with those parameters. This
method will make it easy for others to use.

I dont think it is possible to share mask variables
across blocks at the same level.

Navan

--- mary guo <> wrote:
> Hi,
>
> In simulink I have a system established. I also
> created some s-functions for the system. These
> s-functions all have parameters to enter. And they
> have shared parameters as well. For the parameters
> unique to each s-function, I can enter the paramter
> values from the s-function block parameter dialog
> box. But for the shared parameters, I wanted to
> update only one place and have all the s-functions
> involved get updates automatically.
>
> One way to do this is to change the shared
> parameters to input signals and they go to each
> s-function block that needs it. But what if I want
> to keep it as parameter, Is there an alternative
> way?
>
> Is it possible that I use the same variable name
> from the mask workspace and somehow link the mask
> workspace with an constant output from the system?
>
> Thanks.
>
> Mary


__________________________________________________