Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the signal label in Simulink.
Simulink
set_param(gco, '[1]', 'SpeedSignal')
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'SignalName' instead of 'LabelString'.
Using 'Name' which sets block name, not signal label.
✗ Incorrect
The 'LabelString' parameter is used to set the signal label on Simulink signal lines.
2fill in blank
mediumComplete the code to get the label of a signal line in Simulink.
Simulink
label = get_param([1], 'LabelString')
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gcb' which returns block path, not handle.
Using 'gcs' which returns current system.
✗ Incorrect
The function 'gco' returns the handle of the current object, which is needed to get the signal label.
3fill in blank
hardFix the error in the code to label a signal line correctly.
Simulink
set_param([1], 'LabelString', 'OutputSignal')
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gcb' or 'gcbh' which refer to blocks, not signal lines.
Using 'gcs' which refers to the current system.
✗ Incorrect
The function 'gco' returns the handle of the current object, which is the signal line to label.
4fill in blank
hardFill both blanks to create a labeled signal line in Simulink.
Simulink
add_line([1], [2], 'autorouting', 'on')
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gcb' instead of 'gcs' for system.
Swapping port numbers in the vector.
✗ Incorrect
The current system is 'gcs' and the port connectivity is specified as [1, 2] for source and destination ports.
5fill in blank
hardFill all three blanks to label a signal line and set its properties.
Simulink
line = add_line([1], [2], 'autorouting', 'on'); set_param(line, '[3]', 'SpeedSignal')
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Name' instead of 'LabelString' for signal property.
Incorrect port vector order.
✗ Incorrect
Use 'gcs' for current system, port vector [1, 2], and 'LabelString' to set the signal label property.
