skip to Main Content


MATLAB Programming Language

MATLAB, also referred to as matrix laboratory, is a kind of a multi-paradigm environment for numerical computing. This kind of numerical computing is a programming language categorized in the fourth-generation computing languages. This programming language was solely created and efficiently developed by MathWorks. This language can be used for many programming purposes because it is very dynamic. It allows for the implementation of algorithms and matrix manipulations. Furthermore, it is used for the plotting of data and functions together with the creation of user interfaces.

MATLAB can also be effectively interfaced with programs that are written in other languages. It is compatible with programs written in Python, Java, C, FORTRAN and C++. Though the pivotal intention of MATLAB development was for numerical computing, there exists a toolbox that gives it an array of other uses. The MuPAD symbolic engine is the toolbox that was developed to allow MATLAB to be used for symbolic computing purposes. Furthermore, an additional package that is known as Simulink is used to add graphical multi-domain simulation.

A model-based Simulink design is also used for dynamic and embedded systems that make use of MATLAB programming language. In the past decade, there have been over a million users of MATLAB across different kinds of industries and academia. Some of the main MATLAM language users come from diferent academia disciplines that include science, engineering and economics. Furthermore, this language makes it easy for researchers in different institutions and industrial enterprises to compute and record data effectively and quickly.

In the late 1970s, Cleve Moler started developing MATLAB. He was the chairman of the computer science department at the time in the University of New Mexico. During the time, Cleve discovered that students had to access LINPACK and EISPACK through FORTRAN. Therefore, he developed MATLAB programming language with a main aim to help students to access EISPACK and LINPACK quickly without having to learn FORTRAN. Since it made students to access LINPACK and EISPACK quickly, MATLAB programming language gained popularity within the applied mathematics communities in many universities.

In 1983, Jack Little met with Moler at Stanford University. Jack recognized that MATLAB had huge commercial profitability potential. He joined with Steve Bangert and Moler. In 1984 they rewrote MATLAB using C programming language and founded the MathsWorks Company. After rewriting, they named these new libraries as JACKPAC. LAPACK is a MATLAB rewrite that uses newer sets of libraries. The new libraries are very important for matrix manipulation.

The researchers and practitioners in the control engineering discipline, which was Little’s specialty, were the first to embrace the use MATLAB massively. Nonetheless, the use of this programming language spread to other domains quickly. MATLAB has also extended even into the academia domain mainly in the effective teaching of numerical analysis and linear algebra. Due to its dynamic nature, MATLAB has also gained ground among image processing researchers and scientists.


This programming language’s application is built around the scripting language. Extensive use of the MATLAB language application involves the use of a command window. The window is used entirely for the execution of text files that contain MATLAB code and is used as an interactive mathematical shell.

MATLAB Variables

Since types are unreservedly converted, MATLAB is considered to be a weakly typed kind of programming language. The variables in this language are well defined with the use of the assignment operator, =. It is a contingent typed language since its variables can assigned without declaring their type. Nonetheless, their type is declared only when they are required to be treated as symbolic objects. In the cases where they are treated as symbolic objects, their types can change.

The values of the MATLAB variables can originate from many sources. They can originate from computations that involve values of other variables, from constants, or even from the output of a function.

MATLAB Structures

The MATLAB programming language has structure data types. The language is referred to as “structure array” because all its variables are arrays. Furthermore, every element that is contained in the array has similar field names. It is also evident that MATLAB entirely supports dynamic field names. The dynamism enables users to look-up fields by names and other field manipulations. Nonetheless, MATLAB structures are not supported in any way by MATLAB JIT. Thus, whenever a user requires bundling a variety of variables into a structure they are required to spend a significant amount of money.


MATLAB programming language has some certain order to enable users to find files easily and precisely. When a function is created in MATLAB, the name of the file is set always to match the first function that is contained in the file. Function names that are valid always begin with an alphabetic character. Furthermore, these functions are not restricted to alphabetic characters because they can also contain underscores, numbers and letters.

Function Handles

MATLAB is necessary in the field of lambda calculus because it supports their elements with the introduction of functional handles. Also, MATLAB supports function references in lambda calculus that are implemented either in anonymous/nested or .m files functions.
Classes and Object-Oriented Programming

There are features that MATLAB programming language makes use of to support object-oriented programming. The features include virtual dispatch, classes, packages, pass-by-reference semantics, inheritance, and pass-by-value semantics. Nevertheless, there is a huge disparity with other languages in terms of calling conventions and syntax. MATLAB programming language has reference classes and value classes. The categorization depends on whether the class has handle as a super-class (applicable for reference classes) or not (applicable for value classes).

Method call behavior in MATLAB programming language is diverse between reference and value classes. For instance, a call to a process

object.process ();

Can change any member of object provided that object is an instance of a reference class.

An example of a simple class is provided below.

classdef good morning


function greet(this)

disp(‘Good morning!’)




When put into a file named goodmorning.m, this can be executed with the following commands:

x = good morning;


Good morning!
Vectors and matrices

`The colon syntax is extensively used in the description of simple arrays: init:increment:terminator. For example, an array = 1:2:9 means that the array has 1 3 5 7 9 variables. The init, initial, value of this array starts its count at 1. The increments from the previous value are increased by 2 with every step of the array. Also, the array will stop once it reaches 9 thus it avoids exceeding this terminator value.

When an array is represented as array = 1:3:9, the actual values of these array are array = 1 4 7. In another instance, the increment value can be omitted from this syntax. Additionally, the colons can also be left out to effectively use a default value of 1.

ari = 1:5

ari = 1 2 3 4 5

The variable named ari is an array that contains the values 1,2,3,4, and 5. Since the increment is 1 it can be omitted. Additionally, indexing is one-based. This indexing is the usual convention for matrices in mathematics. Nevertheless, this indexing is not applicable in some programming languages like Java, C++ and C. Matrices can be defined through the separation of elements in every row with a blank space or comma.

Every one of these rows is terminated using a semicolon. It is the norm and accepted criteria that the list of elements should be surrounded by square brackets: []. Parentheses: () are used in the accessing of elements together with sub-arrays. Furthermore, parentheses are used in the denotation of a function argument list.

Sets of indices can be precisely specified by making use of expressions like “2:4”, which evaluates to [2, 3, 4]. A square identity matrix that has a size n can be precisely generated using the function eye. On the other hand, the matrices of any size that have zeros or ones can be generated with the functions zeros and ones correspondingly.


ans =

1 0 0

0 1 0

0 0 1


ans =

0 0 0

0 0 0


ans =

1 1 1

1 1 1

A majority of the MATLAB functions are compatible with and accept matrices. They also apply themselves to each element. For example, mod (3*H,n) will multiply every element in “H” by 3, and then reduce each element modulo “n”. MATLAB programming language does include standard “for” and “while” loops. However, as in other similar applications like R, making use of the vectorized notation in most cases produces a code that is faster in its execution. This code, derived entirely from the function magic.m, creates a magic M that is applicable for odd values of n. Meshgrid, which is a MATLAB function, is effectively used in the generation of square matrices I and J that contain 1:n.
Graphics and graphical user interface programming

MATLAB programming language entirely supports the development of applications that make use of graphical user of interface features. The language has a GUIDE, known as GUI development environment. This guide is extensively used in the graphical designing of GUIs. Furthermore, the language has precisely and tightly integrated graph-plotting features. For instance, A MATLAB program can produce three-dimensional graphics using the functions surf, plot3 or mesh.

In the MATLAB programming language, graphical user interfaces can be effectively programmed. The programming of these user interfaces can be done making use of the GUI design environment (GUIDE) tool. The codes created using the MATLAB language produce wireframe and surface 3D plot of the 2-dimensional unnormalized sinc functions.
Ability to interface with other languages

The MATLAB programming language can call subroutines and function that are written entirely in the FORTRAN or C programming language. The MATLAB data types are passed and returned with the assistance of a wrapper function that is created for the interfacing purposes. Additionally, MATLAB executable files (MEX-files) are created by creating loadable dynamic object files. Recently, there has been a progressive increase of two way interfacing between MATLAB and python programming languages.

Libraries written in .NET, Java, Perl or ActiveX can be called directly from the MATLAB language. A majority of the MATLAB libraries for instance SQL or XML support are well implemented by making extensive use of wrappers around ActiveX or Java libraries. The process of calling MATLAB from Java is complicated. Nevertheless, it is made easier with the help of an undocumented mechanism referred to as Java-to-MATLAB Interface. Also, the process can be simplified by making use of the MATLAB toolbox to call MATLAB from Java.
Advantages of MATLAB

This programming language has a significantly large database of built-in algorithms for computer vision applications and image processing. The database is still growing thus making MATLAB quite advantageous for use.

The ability to auto-generate C code, using MATLAB Coder, for a large subset of image processing and mathematical functions. This ability enables MATLAB to be used in other environments like being used as a component in other software or as embedded systems in these other software.

The MATLAB Desktop environment, which allows a user to work interactively with their data, assists them extensively to keep track of files and variables. Additionally, the programming language simplifies common programming/debugging tasks

This language has the ability to call external libraries, for example OpenCV

MATLAB contains clearly written documentation with many examples. Also, the documentation contains online resources such as web seminars (“webinars”).

Bi-annual updates with new algorithms, features, and performance enhancements

Technical support from a well-staffed, professional organization
Lots of free code and knowledge sharing from the large user community

MATLAB allows the user to test algorithms promptly without the need for any recompilation. Users can type anything at the command line or execute a section in the editor and view the results promptly. This timely nature facilitates the algorithm development process significantly.
If one is conversant in using MATLAB for other purposes, such as statistics, simulation, data analysis or optimation, then it is easier for the user to learn how to use MATLAB in image processing quickly.
The MATLAB programming language has the ability to process both still images and video.
The MATLAB programming language has the ability to read in an expansive variety of common image formats. Furthermore, this programming language also reads the images whose formats are specified in certain domains that are specific.
MATLAB License

MathWorks is the sole creator of the MATLAB programming language. Due to this proprietorship, the users are subjected to vendor lock-in because there is no competition in the creation of the MATLAB codes. It is evident that future developments will be extensively tied only to the MATLAB language. This interconnection is the most probable even though MATLAB Builder products can successfully deploy MATLAB functions in the form library files. The library files are known to be compatible with Java and .NET but they do not affect the strong probability of future developments’ connections with the MATLAB language.

MathWorks sells every MATLAB toolbox separately and provides evaluation licenses after it is serviced with details of the entire project in which MATLAB is to be used. Whenever the license is granted by MathWorks, it is often valid for a period of between two and four weeks.


Back To Top