This extension enables you to run MATLAB® scripts, functions, and statements as part of your build pipeline. You also can run your MATLAB and Simulink® tests, generate artifacts such as JUnit test results and Cobertura code coverage reports, and publish your results to Azure Pipelines.
MATLAB is a package that has been purpose-designed to make computations easy, fast and reliable. It is installed on machines run by Bath University Computing Services (BUCS), which can be accessed in the BUCS PC Labs such as those in 1 East 3.9, 1 West 2.25 or 3 East 3.1, as well as from any of the PCs in the. MATLAB (an abbreviation of 'matrix laboratory') is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks.MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages.
To run your pipeline using the extension, install the extension to your Azure DevOps organization. (To install the extension, press the Get it free button at the top of this page.) You can use the extension with self-hosted or Microsoft®-hosted agents:
If you want to use a self-hosted agent, you must set up a computer with MATLAB (R2013b or later) as your self-hosted agent and register the agent with Azure Pipelines.
If you want to use a Microsoft-hosted agent, you must include a task in your pipeline to install MATLAB on the agent. Currently, this task is available only for public projects and does not include transformation products, such as MATLAB Coder™ and MATLAB Compiler™.
Usage Examples
When you author your pipeline, the extension provides you with a task to run MATLAB scripts, functions, and statements. The extension also provides a task to run MATLAB and Simulink tests. Additionally, you can specify a Microsoft-hosted agent to run your MATLAB code.
Run MATLAB Script
Use the Run MATLAB Command task to run MATLAB scripts, functions, and statements tailored to your specific needs. You can use this task to flexibly customize your test run or add a build step to your pipeline.
For example, in a file named azure-pipelines.yml
in the root of your repository, author a pipeline to run the commands in a file named myscript.m
.
Run Tests in MATLAB Project
Use the Run MATLAB Tests task to automatically run tests authored using the MATLAB Unit Testing Framework or Simulink Test™. You can use this task to generate different types of test and coverage artifacts. You can then publish the artifacts to Azure Pipelines.
For example, author a pipeline to run the tests in your MATLAB project automatically, and then generate a PDF test results report, JUnit test results report, and Cobertura code coverage report at specified locations on the build agent. Use tasks to publish the generated artifacts to Azure Pipelines once the tests are executed. You can access the artifacts in the pipeline summary window:
- To download the PDF test results report, follow the published link.
- To view the JUnit test results report, open the Tests tab.
- To view the Cobertura code coverage report, open the Code Coverage tab.
Specify MATLAB in Pipeline
When you use the Run MATLAB Command or Run MATLAB Tests tasks in your pipeline, the self-hosted agent uses the topmost MATLAB version on the system path. The build fails if the operating system cannot find MATLAB on the path.
You can prepend your desired version of MATLAB to the PATH environment variable of the agent. For example, prepend MATLAB R2020b to the path and use it to run your script.
Use MATLAB on Microsoft-Hosted Agent
Use the Install MATLAB task when you want to run MATLAB code in public projects that utilize Microsoft-hosted agents. The task installs your specified MATLAB release (R2020a or later) on a Linux® virtual machine and enables the agent to run MATLAB scripts, functions, statements, and tests. If you do not specify a release, the task installs the latest release of MATLAB.
Use this task in conjunction with the Run MATLAB Command or Run MATLAB Tests tasks. For example, install MATLAB R2020a on a Microsoft-hosted agent to run the commands in your script.
Tasks
You can access the extension tasks and add them to your pipeline when you edit your pipeline in Azure DevOps.
Run MATLAB Command
Execute a MATLAB script, function, or statement. Specify the task in your pipeline YAML using the RunMATLABCommand
key.
Argument | Description |
---|---|
command | (Required) Script, function, or statement to execute. If the value of command is the name of a MATLAB script or function, do not specify the file extension. If you specify more than one MATLAB command, use a comma or semicolon to separate the commands.Example: myscript Example: results = runtests, assertSuccess(results); |
MATLAB exits with exit code 0 if the specified script, function, or statement executes successfully without error. Otherwise, MATLAB terminates with a nonzero exit code, which causes the build to fail. You can use the assert
or error
functions in the command to ensure that builds fail when necessary.
When you use this task, all of the required files must be on the MATLAB search path.
Matlab Onramp
Run MATLAB Tests
Run the tests in a MATLAB project and generate artifacts. Specify the task in your pipeline YAML using the RunMATLABTests
key.
By default, MATLAB includes any files in your project that have a Test
label. If your pipeline does not leverage a MATLAB project or uses a MATLAB release before R2019a, then MATLAB includes all tests in the root of your repository including its subfolders.
The Run MATLAB Tests task lets you customize your test run using optional arguments. For example, you can add folders to the MATLAB search path, have control over which tests to run, and generate different types of artifacts.
Argument | Description |
---|---|
sourceFolder | (Optional) Locations of the folders containing source code, relative to the project root folder. The specified folders and their subfolders are added to the top of the MATLAB search path. To generate a code coverage report, MATLAB uses only the source code in the specified folders and their subfolders. You can specify multiple folders using a colon-separated or semicolon-separated list. Example: source Example: source/folderA; source/folderB |
selectByFolder | (Optional) Locations of the folders used to select test suite elements, relative to the project root folder. To create a test suite, MATLAB uses only the tests in the specified folders and their subfolders. You can specify multiple folders using a colon-separated or semicolon-separated list. Example: test Example: test/folderA; test/folderB |
selectByTag | (Optional) Test tag used to select test suite elements. To create a test suite, MATLAB uses only the test elements with the specified tag. Example: Unit |
testResultsPDF | (Optional) Path to write test results report in PDF format (currently not supported on macOS platforms). Example: test-results/results.pdf |
testResultsJUnit | (Optional) Path to write test results report in JUnit XML format. Example: test-results/results.xml |
testResultsSimulinkTest | (Optional) Path to export Simulink Test Manager results in MLDATX format (requires Simulink Test license and is supported in MATLAB R2019a or later). Example: test-results/results.mldatx |
codeCoverageCobertura | (Optional) Path to write code coverage report in Cobertura XML format. Example: code-coverage/coverage.xml |
modelCoverageCobertura | (Optional) Path to write model coverage report in Cobertura XML format (requires Simulink Coverage™ license and is supported in MATLAB R2018b or later). Example: model-coverage/coverage.xml |
Install MATLAB
Install the specified MATLAB release on a Linux agent in the cloud. Specify the task in your pipeline YAML using the InstallMATLAB
key.
Argument | Description |
---|---|
release | (Optional) MATLAB release to install. You can specify R2020a or a later release. If you do not specify release , the task installs the latest release of MATLAB.Example: R2020a |
Currently, this task is available only for public projects and does not include transformation products, such as MATLAB Coder and MATLAB Compiler.
Contact Us
If you have any questions or suggestions, please contact MathWorks® at continuous-integration@mathworks.com.
Developer(s) | MathWorks |
---|---|
Stable release | 10.2 (part of R2020b) / September 17, 2020; 6 months ago |
Operating system | Linux, macOS, Microsoft Windows[1] |
License | Proprietary |
Website | mathworks.com |
Simulink is a MATLAB-based graphical programming environment for modeling, simulating and analyzing multidomain dynamical systems. Its primary interface is a graphical block diagramming tool and a customizable set of block libraries. It offers tight integration with the rest of the MATLAB environment and can either drive MATLAB or be scripted from it. Simulink is widely used in automatic control and digital signal processing for multidomain simulation and model-based design.[2][3]
Add-on products[edit]
MathWorks and other third-party hardware and software products can be used with Simulink. For example, Stateflow extends Simulink with a design environment for developing state machines and flow charts.
Matlab Onramp
MathWorks claims that, coupled with another of their products,[4] Simulink can automatically generateCsource code for real-time implementation of systems. As the efficiency and flexibility of the code improves, this is becoming more widely adopted for production systems,[5][6] in addition to being a tool for embedded system design work because of its flexibility and capacity for quick iteration[citation needed]. Embedded Coder creates code efficient enough for use in embedded systems.[7][8][9]
Simulink Real-Time (formerly known as xPC Target), together with x86-based real-time systems, is an environment for simulating and testing Simulink and Stateflow models in real-time on the physical system. Another MathWorks product[10] also supports specific embedded targets. When used with other generic products,[11] Simulink and Stateflow can automatically generate synthesizableVHDL and Verilog[citation needed].
Simulink Verification and Validation enables systematic verification and validation of models through modeling style checking, requirements traceability and model coverage analysis. Simulink Design Verifier uses formal methods to identify design errors like integer overflow, division by zero and dead logic, and generates test case scenarios for model checking within the Simulink environment.
SimEvents is used to add a library of graphical building blocks for modeling queuing systems to the Simulink environment, and to add an event-based simulation engine to the time-based simulation engine in Simulink.[12]
Therefore in Simulink any type of simulation can be done and the model can be simulated at any point in this environment.
Different type of blocks can be accessed using the Simulink library browser. And therefore the benefit could be taken out from this environment efficiently.
Release history[edit]
MATLAB Version[13][14] | Release name | Simulink version | Year | Notes |
---|---|---|---|---|
1.0 | 1984 | |||
2 | 1986 | |||
3 | 1987 | |||
3.5 | 1990 | Ran on MS-DOS but required at least a 386 processor. Version 3.5m required math coprocessor | ||
4 | 1992 | Renamed from Simulab to SIMULINK[15] | ||
4.2c | R7 | 1994 | Ran on Windows 3.1. Required a math coprocessor | |
5.0 | R8 | 1996 | ||
5.1 | R9 | 1997 | ||
5.1.1 | R9.1 | |||
5.2 | R10 | 1998 | ||
5.2.1 | R10.1 | |||
5.3 | R11 | 1999 | ||
5.3.1 | R11.1 | |||
6.0 | R12 | 2000 | ||
6.1 | R12.1 | 2001 | ||
6.5 | R13 | Simulink 5.0.2 | 2002 | |
6.5.1 | R13SP1 | Simulink 5.1 | 2003 | |
6.5.2 | R13SP2 | Simulink 5.2 | ||
7 | R14 | Simulink 6.0 | 2004 | |
7.0.1 | R14SP1 | Simulink 6.1 | ||
7.0.4 | R14SP2 | Simulink 6.2 | 2005 | |
7.1 | R14SP3 | Simulink 6.3 | ||
7.2 | R2006a | Simulink 6.4 | 2006 | |
7.3 | R2006b | Simulink 6.5 | ||
7.4 | R2007a | Simulink 6.6 | 2007 | |
7.5 | R2007b | Simulink 7.0 | Last release for Windows 2000 and PowerPC Mac. | |
7.6 | R2008a | Simulink 7.1 | 2008 | |
7.7 | R2008b | Simulink 7.2 | ||
7.8 | R2009a | Simulink 7.3 | 2009 | First release for 32-bit & 64-bit Windows 7. |
7.9 | R2009b | Simulink 7.4 | First release for Intel 64-bit Mac, and last for Solaris SPARC. | |
7.10 | R2010a | Simulink 7.5 | 2010 | Last release for Intel 32-bit Mac. |
7.11 | R2010b | Simulink 7.6 | ||
7.12 | R2011a | Simulink 7.7 | 2011 | |
7.13 | R2011b | Simulink 7.8 | ||
7.14 | R2012a | Simulink 7.9 | 2012 | |
8 | R2012b | Simulink 8.0 | ||
8.1 | R2013a | Simulink 8.1 | 2013 | |
8.2 | R2013b | Simulink 8.2 | ||
8.3 | R2014a | Simulink 8.3 | 2014 | |
8.4 | R2014b | Simulink 8.4 | ||
8.5 | R2015a | Simulink 8.5 | 2015 | |
8.6 | R2015b | Simulink 8.6 | Last release supporting 32-bit Windows | |
9.0 | R2016a | Simulink 8.7 | 2016 | |
9.1 | R2016b | Simulink 8.8 | ||
9.2 | R2017a | Simulink 8.9 | 2017 | |
9.3 | R2017b | Simulink 9.0 | ||
9.4 | R2018a | Simulink 9.1 | 2018 | |
9.5 | R2018b | Simulink 9.2 | ||
9.6 | R2019a | Simulink 9.3 | 2019 | Simulink Onramp; Schedule Editor; |
9.7 | R2019b | Simulink 10.0 | Toolstrip; Messages; Blockset Designer; Subsystem Reference | |
9.8 | R2020a | Simulink 10.1 | 2020 | |
9.9 | R2020b | Simulink 10.2 |
See also[edit]
- Simplorer
References[edit]
- ^'System Requirements and Platform Availability by Product'. mathworks.com. Retrieved 15 October 2015.
- ^'The Successful development process with MATLAB Simulink in the framework of ESA's ATV project'(PDF). Vega Group PLC. Archived from the original(PDF) on 2011-07-17. Retrieved 2011-11-01.
- ^'Model Based Design Accelerates the Development of Mechanical Locomotive Controls'. sae.org. Retrieved 28 June 2015.
- ^'Automatic Code Generation - Simulink Coder'. mathworks.com. Retrieved 28 June 2015.
- ^A Software Safety Certification Plug-in for Automated Code Generators: Feasibility Study and Preliminary Design
- ^BioAge Media. 'Green Car Congress: General Motors Developed Two-Mode Hybrid Powertrain With MathWorks Model-Based Design; Cut 24 Months Off Expected Dev Time'. greencarcongress.com. Retrieved 28 June 2015.
- ^Lotus Engineering Develops Control Systems Software to Reduce Diesel Emissions
- ^A Comparison of Three Code Generators for Models Created in SimulinkArchived 2010-08-11 at the Wayback Machine
- ^'Multitarget modeling reduces ECU software costs'. EETimes. Archived from the original on 18 October 2007. Retrieved 28 June 2015.
- ^'Code Generation - Embedded Coder - Simulink'. mathworks.com. Retrieved 28 June 2015.
- ^HDL Coder
- ^Cassandras, Christos (2007-11-27). 'Introduction to Discrete-Event Simulation'. Springer US. Archived from the original on 2013-02-02. Retrieved 2009-11-03.
- ^Mathworks. 'MatLab & Simulink: Simulink Reference R2015b'(PDF). Retrieved 28 September 2015.
- ^Mathworks (June 2009). 'list of version and release numbers for Simulink'. Retrieved December 14, 2010.
- ^'THE MATHWORKS ANNOUNCES SHIPMENT OF SIMULINK ON MICROSOFT WINDOWS'. thefreelibrary.com. Retrieved 28 June 2015.