Complete the code to create a subsystem block named 'MySubsystem' in Simulink.
add_block('built-in/Subsystem', '[1]');
The add_block function adds a subsystem block with the specified name. Here, the name 'MySubsystem' is used.
Complete the code to set the position of the subsystem block to [100 100 200 200].
set_param('[1]', 'Position', [100 100 200 200]);
The set_param function sets parameters of a block. The first argument is the block name, here 'MySubsystem'.
Fix the error in the code to add an Inport block inside the subsystem named 'MySubsystem'.
add_block('built-in/Inport', '[1]/In1');
The block path must be a string with the subsystem name and port name separated by a slash. The entire path must be in quotes.
Fill both blanks to connect the output of the Inport block to a Gain block inside 'MySubsystem'.
add_block('built-in/Gain', '[1]/Gain1'); add_line('[2]', 'In1/1', 'Gain1/1');
Both the Gain block and the line connection must be inside the same subsystem 'MySubsystem'.
Fill all three blanks to set the Gain value to 5, and connect the Gain output to an Outport block inside 'MySubsystem'.
set_param('[1]/Gain1', 'Gain', '[2]'); add_block('built-in/Outport', '[3]/Out1'); add_line('[3]', 'Gain1/1', 'Out1/1');
The Gain block's 'Gain' parameter is set to '5'. The Outport block and the line connecting Gain to Outport are inside 'MySubsystem'.
