Top 1,000 Features Creators Events Podcasts Extensions Interviews Blog Explorer CSV

MATLAB

< >

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

#24on PLDB 40Years Old 312kRepos
Homepage · Leet Sheet · Blog · Wikipedia · Subreddit · Twitter · FAQ · Release Notes · Docs · Mailing List

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 Example Token
Standard Library
disp('Hello, World!')
Scientific Notation
Print() Debugging disp
Line Comments
% A comment
%
Operator Overloading
Iterators
% 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
end
File Imports
import pkg.cls1
import pkg.pkfcn
Type Casting
b = cast(a, 'like', p)
Constructors
MultiLine Comments
%{
A comment.
%}
%{ %}
Comments
% This is a comment
Strings
"hello world"
'
Semantic Indentation X

View source

- Build the next great programming language · About · Resources · Acknowledgements · Part of the World Wide Scroll