| Using Simulink | ![]() |
Saving a Model
You can save a model by choosing either the Save or Save As command from the File menu. Simulink saves the model by generating a specially formatted file called the model file (with the .mdl extension) that contains the block diagram and block properties.
If you are saving a model for the first time, use the Save command to provide a name and location for the model file. Model file names must start with a letter and can contain no more than 63 letters, numbers, and underscores. The file name must not be the same as that of a MATLAB command.
If you are saving a model whose model file was previously saved, use the Save command to replace the file's contents or the Save As command to save the model with a new name or location. You can also use the Save As command to save the model in a format compatible with previous releases of Simulink (see Saving a Model in Earlier Formats).
Simulink follows this procedure while saving a model:
mdl file for the model already exists, it is renamed as a temporary file.
PreSaveFcn callback routines, then executes the block diagram's PreSaveFcn callback routine.
mdl.
PostSaveFcn callback routines, then executes the block diagram's PostSaveFcn callback routine.
If an error occurs during this process, Simulink renames the temporary file to the name of the original model file, writes the current version of the model to a file with an .err extension, and issues an error message. Simulink performs steps 2 through 4 even if an error occurs in an earlier step.
| Editor Components | Saving Models with Different Character Encodings | ![]() |
© 1994-2005 The MathWorks, Inc.