How to use base workspace variables while initializing the masked block in MATLAB?

Go To StackoverFlow.com

0

I have a structure called "uwb" in the base workspace. Under the uwb structure I have another structure called "channel". Under channel I have got two variables, a and b. Now I want to create a subsystem. I want to mask the block. My problem is I have to use the variables a and b for the initialization of the masked subsystem. How can I include a and b in initialization commands of the subsystem while masking?

2012-04-05 16:29
by Sujeet Padhi


0

After creating a mask for the subsystem:

  1. Select the Parameters tab in the subsystem mask editor to add tunable dialog parameters.
  2. Add the dialog parameters for each variable you need to access (i.e. call them maska and maskb).
  3. Head over to the Initialization tab and add your initialization code referring to the dialog parameter names maska and maskb. Apply your changes close the mask editor window.
  4. Double click on the masked subsystem and you should be prompted to enter values for the two dialog parameters that were just setup.
  5. In the textfields, type in the workspace variables uwb.channel.a and uwb.channel.b to assign their values to maska and maskb respectively.

As long as the uwb struct is in the base workspace when the model is initialized to run, the masked subsystem will evaluate and assign the a and b appropriately.

(I just tried it out and it seems to work fine, here is the model as a reference: http://sfwn.in/Fejp)

2012-04-07 13:25
by safwanc
Ads