MATLAB: How to change Simulink preferences on the fly

simulinksimulink preferences

Hi,
Is there a way to change Simulink Preferences for a model file from command line? I want to disable Auto Save option for a Simulink model before I simulate? I tried opening the model and using set_param(ModelName,'AutoSaveOptions',0). But it does not work (as there is no 'AutoSaveOptions' parameter)
Any help would be greatly appreciated.
Thanks in advance!

Best Answer

AutoSave etc are not model properties. They are simulink properties (applicable to all simulink models). So you should use set_param(0, 'AutoSaveOptions',....)
example:
strucAutoSaveOptions.SaveBackupOnVersionUpgrade = 1;
strucAutoSaveOptions.SaveOnModelUpdate = 1;
set_param(0, 'AutoSaveOptions', strucAutoSaveOptions)