File Exchange Pick of the Week

Our best user submissions

Source Control Information Block

Richard is Consulting Engineer at MathWorks focused on the Embedded Coder product for code generation, primarily in the Aerospace
industry.

Richard’s pick this week is Source Control Information Block by Gavin Walker.

Pick

My pick this week is Source Control Information Block.

Shipping with Simulink is the Model Info block in the Simulink/Model-Wide Utilities library. When placed in a model, this block allows the user to show information about the model such as when it was created, who created it, when was it modified,etc. It also allows the user to show the Model Version.

The problem with this is the Model Version is defined by the model’s Model Properties setting. By default, this is 1.X, where X is incremented each time the model is saved. Opening the Model Propeties dialog and enabling editing (uncheck the “Read Only” checkbox) you can see the command that is used: 1.%<AutoIncrement:X>.

While this can be useful information, it falls short in a practical application where a Configuration Management tool such as SVN or Git is used. In this case, the Model Version most likely will not match the version of the file in the repository.

This is where this MATLAB File Exchange entry in conjunction with Simulink Projects fills the gap. Simulink Projects helps the user organize their work. In addition, Simulink Projects works with Configuration Management tools for source control of the various models and files being used.

The Source Control Information Block leverages Simulink Projects integration with source control tools to allow the user to show the relevant information. The screenshot below shows a comparison of the Model Info block and the Source Control Information block.

The Source Control Information block provides important information that the Model Info block does not. It shows the full file name of the model, not just the model name. In addition, it shows the name of the project that contains the model, the source control revision and if the file has been modified compared to the source control repository.

The Source Control Information block File Exchange entry includes several files. There is an example script that shows using the Source Control Information block, a Simulink Library that contains the block, a slblocks.m file that if on the MATLAB path will place the library in the Simulink Library Browser, and the getSourceControlStatusExample function that retrieves the information to be displayed.

I believe this entry provides capabilites that Simulink users have wanted for quite some time. I would like to see Gavin enhance this by adding a mask that would allow the user to customize the information displayed, similar to what the Model Info block provides. I would also like to see an enhancement to allow the user to customize the content, or at least guidance
on how to customize the block. This would allow the user to merge the information available in the Model Info block with the Source Control Information block.

Comments

Give it a try and let us know what you think here or leave a comment and/or rating for Gavin.

Published with MATLAB® R2017a

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.