Questions Concepts
GitHub icon


MATLAB - Programming language

< >

MATLAB is a programming language created in 1984 by Cleve Moler.

#12on PLDB 39Years Old 312kRepos

MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment. A proprietary programming language 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, including C, C++, C#, Java, Fortran and Python. Although MATLAB is intended primarily for numerical computing, an optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic computing abilities. Read more on Wikipedia...

Example from hello-world:
disp('Hello World')
% Hello World in MATLAB. disp('Hello World');
Example from Linguist:
function [ d, d_mean, d_std ] = normalize( d ) d_mean = mean(d); d = d - repmat(d_mean, size(d,1), 1); d_std = std(d); d = d./ repmat(d_std, size(d,1), 1); end
Example from Wikipedia:
[X,Y] = meshgrid(-10:0.25:10,-10:0.25:10); f = sinc(sqrt((X/pi).^2+(Y/pi).^2)); surf(X,Y,f); axis([-10 10 -10 10 -0.3 1]) xlabel('{\bfx}') ylabel('{\bfy}') zlabel('{\bfsinc} ({\bfR})')

Language features

Feature Supported Token Example
Scientific Notation
Print() Debugging disp
Line Comments %
% A comment
Operator Overloading
% Define an array of integers
myArray = [1,3,5,7,11,13];

for n = myArray
   % ... do something with n
   disp(n)  % Echo integer to Command Window
File Imports
import pkg.cls1
import pkg.pkfcn
Type Casting
b = cast(a, 'like', p)
MultiLine Comments %{ %}
A comment.
% This is a comment
Strings '
"hello world"
Semantic Indentation X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Traffic · Traffic Today · Day 305 · · Logout