saveToSource
Save model workspace changes to the external data source of the model workspace
Syntax
Description
saveToSource( saves the variables
in the model workspace represented by the mdlWks)Simulink.ModelWorkspace
object mdlWks to the MAT-file or script file specified by the
FileName property of the model workspace.
When you set the DataSource property of the model workspace
to 'MAT-File' or 'MATLAB File', the
FileName property specifies the name of the file that acts
as the external data source of the workspace. As you make changes to the variables
in the model workspace, use saveToSource to permanently save
the changes in the external data source.
If an object loaded into the model workspace uses a Simulink.CoderInfo object to
specify code generation settings, Simulink® removes the Simulink.CoderInfo object and saves the
information in the code mapping object for the model.
Examples
Input Arguments
Alternatives
Save the changes to a model workspace by using a Simulink.data.DataConnection object function.
Update the value of a variable in the model workspace. Then save the change.
mw = Simulink.data.connect("myModel.slx")
mw.x = mw.x + 2;
success = saveChanges(mw)
success =
logical
1
Check whether the model workspace contains unsaved changes.
dirty = hasUnsavedChanges(mw)
dirty =
logical
0
Version History
Introduced before R2006a