How can I add configuration parameter widgets in Simulink 6.6(R2007a)?

4 views (last 30 days)
I want to add a "Host Target Communication" widget in the Configuration Parameter Panel like it does the RTDXSIMLIB "Read RTDX" block.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
Adding configuration parameter widgets in general is quite a difficult task for an inexperienced user. The following is how the RTDX Read block does it:
1. The RTDX Read block is placed in a library. Thus, when we drag it into a model, Simulink in effect "copies" it from the library to the model.
2. The block has a CopyFcn callback registered. This can be seen by disabling the library link of the block and then looking at the Block Properties. The CopyFcn callback is a call to a MATLAB file.
3. This MATLAB file is responsible for placing a configuration parameter widget on the Configuration Parameter dialog box.
4. Link for CCS (to which the RTDX block belongs) does it basically with the following steps:
cs = getActiveConfigSet(bdroot);
hdlHostTargetConfig = CCSTargetConfig.HostTargetConfig;
cs.attachComponent(hdlHostTargetConfig);
5. The question that remains is how to create CCSTargetConfig.HostTargetConfig. Each of these terms is a MATLAB class which needs to be created on the path in a @CCSTargetConfig directory and a sub-directory named @HostTargetConfig. To see how this is created refer to the following directory in the MATLAB path:
$MATLABROOT\toolbox\ccslink\ccslinkblks\@CCSTargetConfig
$MATLABROOT\toolbox\ccslink\ccslinkblks\@CCSTargetConfig\@HostTargetConfig
You can use these classes as starting points to create your own configuration parameter widgets. In general, any blockset that adds widgets to the configuration parameters uses this approach. If you have a MATLAB file S-function, then you must place this S-function in a library and register a CopyFcn callback as described above.
You should also note that there is limited support available for doing this and that you should primarily rely on how other Blocksets and Simulink products have implemented this. Creating MATLAB classes in general however is documented.

More Answers (0)

Products


Release

R2007a

Community Treasure Hunt

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

Start Hunting!