MATLAB



MATLAB combines a desktop environment tuned for iterative analysis and design processes with a programming language that expresses matrix and array mathematics directly. It includes the Live Editor for creating scripts that combine code, output, and formatted text in an executable notebook.

  1. Matlab Download
  2. Matlab Online

Introduction to Magnitude in Matlab. MATLAB is a programming environment that is interactive and is used in scientific computing. It is extensively used in a lot of technical fields where problem-solving, data analysis, algorithm development, and experimentation is required. A software package used to perform a range of specific technical computing tasks, including matrix manipulations, plotting of functions and data, implementation of algorithms, and the creation of user interfaces. Tufts University offers a campus-wide license to MATLAB, Simulink, and a full suite of companion products. All faculty, researchers, and students are eligible to download and install.

  • Matlab Tutorial
  • MATLAB Advanced
  • MATLAB Useful Resources
  • Selected Reading

MATLAB is a programming language developed by MathWorks. It started out as a matrix programming language where linear algebra programming was simple. It can be run both under interactive sessions and as a batch job. This tutorial gives you aggressively a gentle introduction of MATLAB programming language. It is designed to give students fluency in MATLAB programming language. Problem-based MATLAB examples have been given in simple and easy way to make your learning fast and effective.

This tutorial has been prepared for the beginners to help them understand basic to advanced functionality of MATLAB. After completing this tutorial you will find yourself at a moderate level of expertise in using MATLAB from where you can take yourself to next levels.

We assume you have a little knowledge of any computer programming and understand concepts like variables, constants, expression, statements, etc. If you have done programming in any other high-level programming language like C, C++ or Java, then it will be very much beneficial and learning MATLAB will be like a fun for you.

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.

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

Matlab

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.

ArgumentDescription
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.

MATLAB

When you use this task, all of the required files must be on the MATLAB search path.

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.

ArgumentDescription
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.

ArgumentDescription
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.

Matlab Download

Contact Us

Matlab Online

If you have any questions or suggestions, please contact MathWorks® at continuous-integration@mathworks.com.