The Model History
The model contains its entire modeling history corresponding to every settings added once to the model. When you save a model as an M-file, you get all the operations performed to the model, including settings that are no longer part of the model.
The model history is automatically enabled when the model is created in the COMSOL Desktop. It is however possible to manually disable the model history recording from the MATLAB prompt with the command:
model.hist.disable
The functions mphload and mphopen automatically disable model history when loading a model.
To enable the model history, enter the command:
model.hist.enable
Compacting the Model History
To clean the M-file for the model so that it contains only the settings that are part of the current model you need to compact the model history before saving the model as an M-file.
To compact the model history in the COMSOL Desktop, from File menu (Windows users) or from the toolbar (Mac and Linux users), select Compact History ().
To compact the model history at the MATLAB prompt enter the command:
model.resetHist