| Contents | Index |
Simulink.fileGenControl(action)
cfg = Simulink.fileGenControl('getConfig')
Simulink.fileGenControl('reset', 'keepPreviousPath',
true)
Simulink.fileGenControl('setConfig', 'config', cfg,
'keepPreviousPath', true, 'createDir', true)
Simulink.fileGenControl('set', 'CacheFolder', cacheFolderPath,
'CodeGenFolder', codeGenFolderPath, 'keepPreviousPath',
true, 'createDir', true)
Simulink.fileGenControl(action) performs a requested action related to the file generation control parameters CacheFolder and CodeGenFolder for the current MATLAB session. CacheFolder specifies the root folder in which to put model build artifacts used for simulation, and CodeGenFolder specifies the root folder in which to put Simulink Coder code generation files. The initial session defaults for these parameters are provided by the Simulink preferences Simulation cache folder and Code generation folder.
cfg = Simulink.fileGenControl('getConfig') returns a handle to an instance of the Simulink.FileGenConfig object containing the current values of the CacheFolder and CodeGenFolder parameters. You can then use the handle to get or set the CacheFolder and CodeGenFolder fields.
Simulink.fileGenControl('reset', 'keepPreviousPath', true) reinitializes the CacheFolder and CodeGenFolder parameters to the values provided by the Simulink preferences Simulation cache folder and Code generation folder. To keep the previous values of CacheFolder and CodeGenFolder in the MATLAB path, specify 'keepPreviousPath' with the value true.
Simulink.fileGenControl('setConfig', 'config', cfg, 'keepPreviousPath', true, 'createDir', true) sets the file generation control configuration for the current MATLAB session by passing a handle to an instance of the Simulink.FileGenConfig object containing values for the CacheFolder and/or CodeGenFolder parameters. To keep the previous values of CacheFolder and CodeGenFolder in the MATLAB path, specify 'keepPreviousPath' with the value true. To create the specified file generation folders if they do not already exist, specify 'createDir' with the value true.
Simulink.fileGenControl('set', 'CacheFolder', cacheFolderPath, 'CodeGenFolder', codeGenFolderPath, 'keepPreviousPath', true, 'createDir', true) sets the file generation control configuration for the current MATLAB session by directly passing values for the CacheFolder and/or CodeGenFolder parameters. To keep the previous values of CacheFolder and CodeGenFolder in the MATLAB path, specify 'keepPreviousPath' with the value true. To create the specified file generation folders if they do not already exist, specify 'createDir' with the value true.
action |
String specifying one of the following actions:
| ||||||||||
'config', cfg |
Specifies a handle cfg to an instance of the Simulink.FileGenConfig object containing values to be set for the CacheFolder and/or CodeGenFolder parameters. | ||||||||||
'CacheFolder', cacheFolderPath |
Specifies a string value cacheFolderPath representing a folder path to directly set for the CacheFolder parameter. | ||||||||||
'CodeGenFolder', codeGenFolderPath |
Specifies a string value codeGenFolderPath representing a folder path to directly set for the CodeGenFolder parameter.
| ||||||||||
'keepPreviousPath', true |
For reset, set, or setConfig, specifies whether to keep the previous values of CacheFolder and CodeGenFolder in the MATLAB path. If 'keepPreviousPath' is omitted or specified as false, the call removes previous folder values from the MATLAB path. | ||||||||||
'createDir', true |
For set or setConfig, specifies whether to create the specified file generation folders if they do not already exist. If 'createDir' is omitted or specified as false, the call throws an exception if a specified file generation folder does not exist. |
cfg |
Handle to an instance of the Simulink.FileGenConfig object containing the current values of the CacheFolder and CodeGenFolder parameters. |
Obtain the current CacheFolder and CodeGenFolder values:
cfg = Simulink.fileGenControl('getConfig');
myCacheFolder = cfg.CacheFolder;
myCodeGenFolder = cfg.CodeGenFolder;Set the CacheFolder and CodeGenFolder parameters for the current MATLAB session by first setting fields in an instance of the Simulink.FileGenConfig object and then passing a handle to the object instance:
% Get the current configuration
cfg = Simulink.fileGenControl('getConfig');
% Change the parameters to C:\cachefolder and current working folder
cfg.CacheFolder = fullfile('C:','cachefolder');
cfg.CodeGenFolder = pwd;
Simulink.fileGenControl('setConfig', 'config', cfg);Directly set the CacheFolder and CodeGenFolder parameters for the current MATLAB session without creating an instance of the Simulink.FileGenConfig object:
myCacheFolder = fullfile('C:','cachefolder');
myCodeGenFolder = pwd;
Simulink.fileGenControl('set', 'CacheFolder', myCacheFolder, ...
'CodeGenFolder', myCodeGenFolder);Reinitialize the CacheFolder and CodeGenFolder parameters to the values provided by the Simulink preferences Simulation cache folder and Code generation folder:
Simulink.fileGenControl('reset');Instead of setting the CacheFolder and CodeGenFolder parameters just for the current MATLAB session, you can set the Simulink preferences Simulation cache folder and Code generation folder, which provide the initial MATLAB session defaults. The preferences can be set using the Simulink Preferences dialog box or using the MATLAB command set_param.
Code generation folder | Simulation cache folder

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |