Mask Initialization Commands in Generated Code

I have some masked subsystem(s)( suppose a look up table) in my model with some mask initialization commands. The initialization commands set table data with a variable name which i couldn't find in the generated code. Is there a way to reflect the initilization commands in the code generated? or how to get that variable to appear in code generation?

5 Comments

TAB
TAB on 10 Dec 2012
Edited: TAB on 10 Dec 2012
Can you explain your case what you have done and what you expect.
Mask initialization command is evaluated during initialization of model and it could be anything written in matlab script. And we can not expect matlab script to appear in generated code.
I have lookup tabledata variable name initilized through mask initilization commands. This variable name is not carried to code (only table data is taken into code;RTW omits the intermediate variable names)& is becoming difficult to trace which table data is passed. I just want the tabledata variable name in the code generated.
I tried renaming the blockname with the table data variable name through mask initialization commands, but only block name inside the mask is appearing in the code instead of mask name.
TAB
TAB on 10 Dec 2012
Edited: TAB on 10 Dec 2012
I am still not able to imagine what is your variable. Is it a base workspace variable or variable created directly in mask initialization pane.
(I am asking because mask workspace is a different worspace and base workspace variables/parameters can't be accessed directly in mask workspace)
Please post your mask initialization code with sufficient explanation of your work with picture, example etc.
sorry if i am troubling you. Thank you for your replies.
It is base workspace variable
In the parameters section of Mask Editor, I have mask dialogue variable lets say 'myVar' with prompt 'Enter Table'. In the base workspace I have a variable say , 'myData'(there are also some other variables in the base workspace) & gave it as input parameter to the masked subsystem. I just need variable name 'myData' in the generated code so that i can trace which variable data is taken.
Here 'myVar' , 'myData' are the intermediate variable names code generator is discarding.It just takes the data contained in 'myData'.
Please see [EDITED 13-Dec-2012] part of my below answer.

Sign in to comment.

Answers (2)

2 Comments

Thank you MS for your reply
I had already referred the content in the link. My question is data table of a look up table is initilaized in mask initilizaion commands with a variable name. I couldn't trace that variable in the generated code. Need to trace the data table variable name in the code.
is it possible to make mask initialization commands to appear as comments in generated code??

Sign in to comment.

TAB
TAB on 10 Dec 2012
Edited: TAB on 13 Dec 2012
You can generate comments in the code specific for each block using Block's Description field.
  1. Write click on block -> Open Block Properties
  2. Enter the text which you want to be generated as comment for this block in Description field. In your case, enter your initialization variable name or mask initialization commands for this block.
  3. If the block is a subsystem (in your case it is a masked subsystem), make it atomic to treat it as one unit. Right click on subsystem -> Open Subsystem parameters -> Enable Treat as atomic unit.
  4. Open Configuration Patameters (Ctrl+E) -> Goto Code Generation > Comments -> Enable fields Include Comments & Simulink block description.
[EDITED 13-Dec-2012]
  1. Goto Configuration Parameters (Ctrl+E)
  2. Goto Symbols pane in Code Generation section.
  3. Set option Generate scalar inlined parameter as to Macros
  4. Generate the code again.
By default your non-tunable inlined parameters are replaced by their values in generated code. Setting above option will generate these parameters as #define MACRO with their name and this macro will be used in calculations.

Products

Asked:

on 10 Dec 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!