主要内容

sharedCodeupdate

Add new shared code source files to existing shared code folder

Description

example

sharedCodeupdate(sourceFolder,destinationFolder)copies, for example, shared utility files fromsourceFolder到子文件夹中destinationFolder前提是文件中不存在destinationFolder。The function:

  • Identifies files in both folders that have identical names but different content. The function does not overwrite these files indestinationFolder。在命令窗口中,您会看到一个comparelink for each file. To examine differences by using the Comparison tool, click the link.

  • ListssourceFolderfiles that the function intends to copy and seeks confirmation. When you provide confirmation, the function copies the files todestinationFolder。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或者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 withBuildFolder

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)将保护模型的共享实用程序复制到共享代码文件夹。

Examples

collapse all

此示例显示了如何将源文件从共享的实用程序文件夹复制到共享代码文件夹。

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.

指定要更新的共享代码文件夹的路径。

pathtoexististingsharedfolder ='C:\mySharedCodeFolder';

Specify the full path to the relocated generated code folderp1_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.

通往a的路径build folderthat 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扩大。

Version History

Introduced in R2016b