0
0
Simulinkdata~10 mins

Simulink Coder overview - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to generate C code from a Simulink model.

Simulink
rtwbuild('[1]')
Drag options to blanks, or click blank then click option'
AmyModel
BbuildModel
CcodeGen
DsimulinkModel
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name instead of a string.
Misspelling the model name.
2fill in blank
medium

Complete the code to set the system target file for code generation.

Simulink
set_param('[1]', 'SystemTargetFile', '[2]')
Drag options to blanks, or click blank then click option'
AmyModel
BSystemTargetFile
Cert.tlc
Dgrt.tlc
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing parameter names.
Using wrong target file name.
3fill in blank
hard

Fix the error in the code to generate code and build the model.

Simulink
rtwbuild([1])
Drag options to blanks, or click blank then click option'
A"myModel"
BmyModel
C'myModel'
DmyModel()
Attempts:
3 left
💡 Hint
Common Mistakes
Passing variable name without quotes.
Using double quotes which may cause issues in older MATLAB versions.
4fill in blank
hard

Fill both blanks to set the code generation folder and build the model.

Simulink
set_param('[1]', 'CodeGenFolder', '[2]')
rtwbuild('[1]')
Drag options to blanks, or click blank then click option'
AmyModel
Bcodegen
Cbuild
Doutput
Attempts:
3 left
💡 Hint
Common Mistakes
Using different model names.
Wrong folder name.
5fill in blank
hard

Fill all three blanks to configure code generation and build the model.

Simulink
set_param('[1]', 'SystemTargetFile', '[2]')
set_param('[1]', 'GenerateReport', '[3]')
rtwbuild('[1]')
Drag options to blanks, or click blank then click option'
AmyModel
Bert.tlc
Con
Doff
Attempts:
3 left
💡 Hint
Common Mistakes
Turning off report generation.
Using wrong target file.