MATLAB: Do I receive an error message when I attempt to open the Simulink model using the OPEN command

modelopensimulink

I receive the following error message when I try to open my Simulink model called 'mymodel.mdl' using the OPEN command within MATLAB:
open('mymodel.mdl')
Warning: Unable to open model file "mmodel.mdl".
> In d:\R11_5P3\toolbox\matlab\general\private\openmdl.m at line 11
In d:\R11_5P3\toolbox\matlab\general\open.m at line 92
??? Error using ==> open
Error using ==> open_system
There is no system named 'mmodel.mdl' to open.

Best Answer

You will receive this error message if you open a Simulink model that is saved in a directory that is not on the MATLAB Search Path since MATLAB is unable to locate the file. To open the model you will need to do one of the following:
- CD to the directory that contains the Simulink model and then open the .mdl file
- Add the directory that contains the Simulink model to the MATLAB Search Path. You can add the directory to the MATLAB Search Path using the Path Browser:
1. Open the path browser on each machine by either clicking the path tool on the toolbar or by typing "pathtool" at the MATLAB Command Prompt. This will show all of the directories on the MATLAB Search Path.
2. Add the directory using the Path->Add To Path pull-down menu and clicking "OK"
3. Go to the Path->Save Path pull-down window to save the directory in the MATLAB Search Path
4. Exit the Path Browser
The directory where the Simulink model is saved should be on the MATLAB Search Path. (You can verify this by typing "path" at the MATLAB prompt). Now you will be able to open up the Simulink model from any directory using the OPEN command.