•Matlab R2011b
•Simulink Coder Version 8.1
•20-sim 4C 2.1 or higher
•Note: The installation path of 20-sim 4C (e.g. C:\Program Files\20-sim 4C 2.1) will in this manual be referred to as the 20-sim 4C installation directory.
1.Open Matlab and go to '<20-sim 4C installation directory>\contrib\matlab\rtw_20sim4C_target\rtw_20sim4C_target'
2.Add the 20-sim target to Matlab: execute ' rtw_20sim4C_target_setup' in the command line using:
run('rtw_20sim4C_target_setup')
1.In Matlab, go to the 20-sim 4C installation directory and then open the 'examples/matlab' directory.
(For the code generation, the simulink model file should be within the present working directory)
2.Open the model 'sines.mdl'.
3.Go to Simulation -> Configuration Parameters:
Configuration parameters
This will open the configuration parameters dialog shown below
Configuration Parameters dialog
Make sure the rtw_20sim4C_target.tlc is selected in the "system target file" section. If not, Click 'Browse' to select the correct file.
System target file selection
4.Click OK to close the configuration parameters dialog.
5.Select the sub model "Subsystem" you need to generate code for.
6.Go to the editor window and change the current directory to a temporary working directory as shown below.
Choosing temporary working directory for saving project files
6.Go to Tools -> Code Generation -> Build Subsystem. Make sure a sub-model is selected first, otherwise the 'Build Subsystem' option remains gray.
Building selected subsystem
Selecting 'Build Subsystem' should open the window shown below.
"Build" button will open the 20sim4C window.