MATLAB Programming Techniques

Write efficient, robust, and well-organized code using features in MATLABĀ®. Take your coding to the next level by learning skills that will take you from someone who writes working MATLAB code to someone who develops high-quality MATLAB applications.

Course modules

Introduction

Overview of the content covered.

Lessons:
  • Course Overview

Structuring Data

Explore choices for storing data within a MATLAB application.

Lessons:
  • MATLAB Data Types
  • Text Data
  • Organizing Data in a Table
  • Extracting Data from a Table
  • Storing Data in a Cell Array
  • Extracting Data from a Cell Array
  • Organizing Data in a Structure
  • Extracting Data from a Structure
  • Review - Structuring Data

Manipulating Heterogeneous Data

Manipulate data in tables, cell arrays, and structure arrays.

Lessons:
  • Extracting Multiple Elements from Cell and Structure Arrays
  • Function Handles
  • Applying Scalar Functions to Arrays
  • Converting Data Types

Optimizing Your Code

Use common techniques for improving performance when storing, accessing, and processing data.

Lessons:
  • Measuring Performance
  • Finding Bottlenecks
  • Vectorization
  • Memory Usage
  • Preallocation
  • Improving Memory Usage in Functions
  • Review - Optimizing Your Code

Creating Flexible Functions

Write functions that can handle different numbers and types of user input values.

Lessons:
  • Creating Flexible Function Interfaces
  • Creating Multiple Interfaces with Wrapper Functions
  • Converting Input Types
  • Querying Function Inputs
  • Setting Default Input Values
  • Allowing Any Number of Inputs
  • Matching Text Inputs to an Allowed Set
  • Allowing a Variable Number of Outputs
  • Changing the Function Interface with Anonymous Functions
  • Review - Creating Flexible Functions

Creating Robust Applications

Create robust applications that withstand unexpected input and produce meaningful errors. Use built-in MATLAB functions and programming constructs, and employ techniques for handling error conditions.

Lessons:
  • Course Example - Structuring the Satellite Tracking Code
  • Restricting Access Using Private Functions
  • Writing Local Functions
  • Generating Custom Warning and Errors
  • Validating Function Inputs
  • Catching and Handling Errors
  • Review - Creating Robust Applications

Verifying Application Behavior

Create tests to verify the application is behaving as expected.

Lessons:
  • Why Use a Testing Framework
  • What Is a Test
  • Writing and Running a Test Script
  • Avoiding Bugs in Comparisons
  • Writing Test Functions
  • Verifying Behavior
  • Passing Commands as Inputs
  • Adding Pre- and Post-Test Tasks

Debugging Your Code

Use integrated tools to debug applications.

Lessons:
  • Repairing Satellite Tracking Code
  • Errors and Debugging
  • Code Analyzer
  • Debugging Run-Time Errors

Organizing Your Projects

Use folder reports, MATLAB Projects, and version control to organize and manage your projects.

Lessons:
  • Organizing Satellite Tracking Code
  • Running Folder Reports
  • Organizing Code with MATLAB Projects
  • Managing a Code Base with Source Control
  • Review - Organizing Your Projects

Conclusion

Learn next steps and provide feedback on the course.

Lessons:
  • Additional Resources
  • Survey

MATLAB Fundamentals

Learn core MATLAB functionality for data analysis, modeling, and programming.

MATLAB for Data Processing and Visualization

Create custom visualizations and automate your data analysis tasks.

Deep Learning with MATLAB

Learn the theory and practice of building deep neural networks with real-life image and sequence data.

MATLAB Onramp

Get started quickly with the basics of MATLAB.

MATLAB Fundamentals

Learn core MATLAB functionality for data analysis, modeling, and programming.