Question
I want to add a block in a Simulink model named myModel.mdl. When I open the model and attempt to add a block using the following code: open myModel.mdl add_block('simulink/Sources/In1','myModel/myin1') I sometimes receive the following error: ??? There is no block named 'simulink/Sources/In1'
Expert Answer
Prashant Kumar
PhD Expert
Answered Aug 27, 2026
The Simulink library must be loaded to programmatically add blocks in a model. The LOAD_SYSTEM function can be used to programmatically load the Simulink library as in this example:
load_system('simulink')
open myModel.mdl
add_block('simulink/Sources/In1','myModel/myin1')
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related simulink Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →