Kevin Cohan, MathWorks
Write programs and develop algorithms using the high-level language and development tools in MATLAB®.
MATLAB® provides a high-level language and development tools that let you quickly write MATLAB programs, develop and analyze algorithms, and build applications.
MATLAB is a matrix-based language – it natively supports vector and matrix operations that are fundamental to engineering and scientific problems.
For example, you can operate on all of the elements in a matrix with a single command – without having to write a for-loop.
As a result, one line of MATLAB code often replaces several lines of C or C++ code.
MATLAB provides features of traditional programming languages, including flow control such as while and for loops, error handling, such as try/catch blocks which allow us to execute statements and catch the resulting errors, and object-oriented programming (OOP).
Here you can see a class defined in MATLAB, together with its properties and methods.
The MATLAB environment is well-suited for algorithm design and exploration. In this example, we’re developing an algorithm to identify the center of a hurricane.
Because MATLAB is a high-level language, there’s no need to perform low-level administrative tasks such as declaring variables, specifying data types, and allocating memory.
Using the Command Window, you can execute commands one at a time, providing you with immediate results.
This interactive approach makes it easy to quickly explore multiple options and iterate to an optimal solution.
You can create a MATLAB script or function from the commands you’ve already entered. This makes it easy to reuse and automate your work.
MATLAB provides built-in algorithms for signal processing and communications, image and video processing, control systems, and many other domains. Here we are using a function from Image Processing Toolbox™ to identify and measure properties of connected regions in an image.
MATLAB provides development tools that help you implement your algorithms efficiently and optimize their performance.
The MATLAB Editor is where you create and edit programs. The Editor provides debugging features. You can set breakpoints, examine variable values, and step through individual lines of code.
The Code Analyzer automatically checks code in the MATLAB Editor for problems.
When you hover over underlined code fragments, the Code Analyzer provides an explanation of the problem and suggestions on how to fix it.
The MATLAB Profiler measures the overall performance of MATLAB programs and identifies areas of code to focus on for improvement.
The Profile Summary report gives information about the functions called, including the time each function took to run, how many times each function was called, and which lines of code took the most processing time.
You can integrate your MATLAB applications with those written in other languages such as C, C++, Java®, and .NET.
Here we have C code for a 2D Gaussian function. This code was compiled into a MEX function, or MATLAB executable, and can be called directly from within MATLAB.
Similarly, you can call MATLAB code directly from your C, C++, or Fortran applications.
MATLAB uses processor-optimized libraries for fast execution of matrix and vector computations.
Many linear algebra and numerical functions are multithreaded, allowing them to run faster on multicore computers.
You can use the high-level constructs found in the parallel computing products to parallelize your applications with only minor code changes. This allows you to take further advantage of multicore desktops and other resources such as GPUs and clusters.
With MATLAB, you can easily transform your ideas into algorithms and complex applications.
For more information about MATLAB, see the product page or watch one of the other videos.