How to set the value of RTWCAPIRootIO in TLC file?

Hello,
I would like to set the value of RTWCAPIRootIO (= Configuration Parameters -> Code Generation -> Interface -> C API -> root-level I/O setting) in a custom TLC file. For the other C API parameters such as "signals" or "parameters", the following lines seems to do the trick, effectively overriding the setting given by the user in the Configuration Parameters dialog:
%assign RTWCAPISignals=1
%assign RTWCAPIParams=1
However,
%assign RTWCAPIRootIO=1
which logically should be doing the same thing for the root I/O setting does not have any effect (tested with both R2011a and R2012b, i.e. the earliest and the most recent versions that have the root I/O setting).
Is this a bug? Or this there another TLC command that one can/should use to change RTWCAPIRootIO?
And most importantly: Is there any comprehensive documentation that covers this aspect of TLC files? The Target Language Compiler Reference Guide seems a bit outdated and the online documentation seems to cover parameters like RTWCAPIRootIO only within the context of the Configuration Parameters panel.
Thanks in advance for any clarification concerning this topic!
Best regards, Fritz

 Accepted Answer

I suspect that there is an internal TLC file that overrides your setting with that obtained from the Configuration Parameters. Note that the technique you are currently using is not exactly recommended for custom targets. It might be better to force the Configuration Parameters setting itself to "true" and make it read-only (if that's what you wish). This will also be more transparent to users of your custom target.
You should be able to use your custom target's SelectCallback with something like:
function my_select_callback_handler(hDlg, hSrc)
slConfigUISetVal(hDlg, hSrc, 'RTWCAPIRootIO', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'RTWCAPIRootIO', false);
Note: I haven't tested out this code, so please consider this as advice rather than a solution.

3 Comments

Thanks, that sounds like a very good solution. I'll try it out right away.
You were also right about the overriding. I could actually locate it in the setuplib.tlc file. For RTWCAPIParams, the code checks the existence before overwriting, while for RTWCAPIRootIO it just overwrites:
%if !EXISTS("RTWCAPIParams")
%assign ::RTWCAPIParams = 0
%endif
vs.
%assign ::RTWCAPIRootIO = 0
===========================================================
Some more info on what is needed to make this solution work: ===========================================================
1. the system target file (the main tlc file) needs to be properly derived from a target that provides the Interface / C API options (e.g. grt.tlc).
2. rtwgensettings.Version must be 1
3. trying to set RTWCAPIRootIO on a Matlab verion prior to R2011a will cause an error. This needs to be handled in the select callback function.
Example of RTW options in the system target file:
rtwgensettings.DerivedFrom = 'grt.tlc';
rtwgensettings.Version = '1';
rtwgensettings.SelectCallback = 'my_select_callback_handler(hDlg, hSrc)';
Thanks a lot for posting a more complete solution!

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!