Main Content

sharedCodeUpdate

Add new shared code source files to existing shared code folder

Description

example

sharedCodeUpdate(sourceFolder, destinationFolder) copies, for example, shared utility files from sourceFolder to a subfolder in destinationFolder provided that the files do not exist within destinationFolder. The function:

  • Identifies files in both folders that have identical names but different content. The function does not overwrite these files in destinationFolder. In the Command Window, you see a compare link for each file. To examine differences by using the Comparison tool, click the link.

  • Lists sourceFolder files that the function intends to copy and seeks confirmation. When you provide confirmation, the function copies the files to destinationFolder. By default, the destination of the copied files is a subfolder that corresponds to the release in which the files were created, for example, R2015a or R2015b.

example

sharedCodeUpdate(sourceFolder, destinationFolder, 'ExistingCodeSubfolder', destinationSubfolder) copies files to the subfolder that you specify.

sharedCodeUpdate(buildFolder, destinationFolder) copies shared code source files from the shared code location associated with buildFolder.

sharedCodeUpdate(buildFolder, configurationSetOrModel) copies shared code source files to the folder specified by the 'ExistingSharedCode' parameter of a Simulink® configuration set or model.

sharedCodeUpdate(protectedModel, destinationFolder) copies shared utility files for the protected model to the shared code folder.

Examples

collapse all

This example shows how to copy source files from a shared utilities folder to a shared code folder.

sourceFolder = fullfile(pwd,'R2015bWork','slprj','ert','_sharedutils');
existingSharedCodeFolder = fullfile(pwd,'SharedUtilCode');
sharedCodeUpdate(sourceFolder, existingSharedCodeFolder);

This example shows how to copy source files from a shared utilities folder to a specified subfolder in the shared code folder.

sourceFolder = fullfile(pwd,'R2015bWork','slprj','ert','_sharedutils');
existingSharedCodeFolder = fullfile(pwd, 'SharedUtilCode');
destinationSubfolder = 'mySub'
sharedCodeUpdate(sourceFolder, existingSharedCodeFolder,...
'ExistingCodeSubfolder', destinationSubfolder);

This example shows how to copy shared utility files from a relocated generated code folder to an existing shared code folder.

Specify path to shared code folder that you want to update.

pathToExistingSharedFolder = 'C:\mySharedCodeFolder';

Specify the full path to the relocated generated code folder P1_ert_rtw.

anchorFolder = 'C:\myWorkFolder';
relocatedCodeFolder = fullfile(anchorFolder, 'P1_ert_rtw');

Update the existing shared code folder.

sharedCodeUpdate(relocatedCodeFolder, pathToExistingSharedFolder);

Input Arguments

collapse all

File path to folder with shared code files that you want to add to existing shared code folder.

File path to existing shared code folder.

Destination subfolder in existing shared code folder.

Path to a build folder that contains previously generated model code.

Simulink configuration set or model that uses an existing shared code folder specified by the 'ExistingSharedCode' parameter.

File path for protected model. File name of protected model must have .slxp extension.

Introduced in R2016b