Using Simulink Previous page   Next Page

Saving Models with Different Character Encodings

When Simulink saves a model, it uses the character encoding in effect when the model was created (the original encoding) to encode the text stored in the model's .mdl file, regardless of the character encoding in effect when the model is saved. This can lead to model corruption if you save a model whose original encoding differs from encoding currently in effect in the MATLAB session.

For example, it's possible you could have introduced characters that cannot be represented in the model's original encoding. If this is the case, Simulink saves the model as model.err where model is the model's name, leaving the original model file unchanged. Simulink also displays an error message that specifies the line and column number of the first unrepresentable character. To recover from this error without losing all the changes you've made to the model in the current session, use the following procedure. First, use a text editor to find the character in the .err file at the position specified by the save error message. Then, returning to Simulink, find and delete the corresponding character in the open model and resave the model . Repeat this process until you are able to save the model without error.

It's possible that your model's original encoding can represent all the text changes that you've made in the current sesssion, albeit incorrectly. For example, suppose you open a model whose original encoding is A in a MATLAB session whose current encoding is B. Further, suppose you edit the model to include a character that has different encodings in A and B and then save the model. For example, suppose that the encoding for x in B is the same as the coding for y in A and you insert x in the model while B is in effect, save the model, and then reopen the model with A in effect. In this scenario, Simulink will display x as y. To alert you to the possibility of such corruptions, Simulink displays a warning message when you save a model and the current and original encoding differ but the original encoding can encode, possibly incorrectly, all the characters to be saved in the model file.

Saving a Model in Earlier Formats

The Save As command allows you to save a model created with the latest version of Simulink in formats used by earlier versions of Simulink, including Simulink 3 (Release 11), Simulink 4 (Release 12), and Simulink 4.1 (Release 12.1). You might want to do this, for example, if you need to make a model available to colleagues who have access only to one of these earlier versions of Simulink.

To save a model in earlier format:

  1. Select Save As from the Simulink File menu.
  1. Simulink displays the Save As dialog box.

  1. Select a format from the Save as type list on the dialog box.
  2. Click the Save button.

When saving a model in an earlier version's format, Simulink saves the model in that format regardless of whether the model contains blocks and features that were introduced after that version. If the model does contain blocks or use features that postdate the earlier version, the model might not give correct results when run by the earlier version. For example, matrix and frame signals do not work in Release 11, because Release 11 does not have matrix and frame support. Similarly, models that contain unconditionally executed subsystems marked "Treat as atomic unit" might produce different results in Release 11, because Release 11 does not support unconditionally executed atomic subsystems.

The command converts blocks that postdate the earlier version into empty masked subsystem blocks colored yellow. For example, post-Release 11 blocks include

Post-Release 11 blocks from Simulink blocksets appear as unlinked blocks.


Previous page  Saving a Model Printing a Block Diagram Next page

© 1994-2005 The MathWorks, Inc.