Documentation

listModifiedFiles

List modified files in Simulink project

Syntax

modifiedfiles = listModifiedFiles(proj)

Description

example

modifiedfiles = listModifiedFiles(proj) returns the list of modified project files in the project object proj. listModifiedFiles refreshes the source control statuses in the project and then returns an array of the project files which are listed in the Modified Files view of the Simulink® Project.

Examples

collapse all

Open the airframe project and create a project object.

sldemo_slproject_airframe;
proj = simulinkproject;

Modify a project model file by adding an arbitrary block.

open_system('AnalogControl')
add_block('built-in/SubSystem', 'AnalogControl/test')
save_system('AnalogControl')

Get all the modified files in the project.

modifiedfiles = listModifiedFiles(proj)
modifiedfiles = 

  1x2 ProjectFile array with properties:

    Path
    Labels
    Revision
    SourceControlStatus

Observe two modified files. Compare with the Modified Files view in Simulink Project, where you can see a modified model file, and the corresponding .SimulinkProject definition file.

Get the second modified file.

modifiedfiles(2)
ans = 

  ProjectFile with properties:

Path: 'C:\Work\temp\slexamples\airframe2\models\AnalogControl.mdl'
                 Labels: [1x1 slproject.Label]
               Revision: '2'
    SourceControlStatus: Modified

Observe the file SourceControlStatus property is Modified. Similarly, listModifiedFiles returns any files that are added, conflicted, deleted, etc., that show up in the Modified Files view in Simulink Project.

Get all the project files with a particular source control status. For example, get the files that are Unmodified.

proj.Files(ismember([proj.Files.SourceControlStatus], matlab.sourcecontrol.Status.Unmodified))
ans = 

  1x29 ProjectFile array with properties:

    Path
    Labels
    Revision
    SourceControlStatus

Input Arguments

collapse all

Project, specified as a project object. Use simulinkproject to create a project object to manipulate a Simulink Project at the command line.

Output Arguments

collapse all

Modified files, returned as an array of file objects.

Introduced in R2016a

Was this topic helpful?