You are on page 1of 4

MATLAB Cheat Sheet 

by LSchu
Cheat Sheet MATLAB - Seminar Dr. Olaf Dimigen

help   Create variables

doc Show documentation

help Show documentation in Arithmetic functions


the command window
2 * 3, 4 Multiplication,
demo Show examples + 5, 3- addition,
2, 9/3, subtraction,
2^2 division,
File types exponentiation

single Single precision sqrt Pulling roots


numerical data (32 exp Exponential
bits) function
double Double precision mean Average
numerical data (64
median Median
bits)
var Variance
char Character array
hours Standard deviation
string String array
Section Absolute value
logical False = 0, True = 1
x*3 Multiply each
struct Structure array
element in vector x
cell Cell array by 3

x+2 Adds x 2 to each


element in the
Import and export
vector
load / Load / save y+x Element-wise
save MATLAB variables addition of y and x
dlmread / Read / save file y*x Product of two
dlmwrite separated by matrices y and x
"delimiters".
y. * x Element-wise
readtable Read / save table product of matrices
/ from file y and x
writetable

imread / Read / save image


imwrite file
Basics Indexing - Matrices

clc Empty command x (i, Element of x in row i


window j) and column j

clear Empty workspace x (:, Elements of x in

close all Close all figures j) column j

whos Shows size, bytes, x (i, Elements of x in row i

class and attributes :)

of a variable x (:, All elements of both

to you Shows the contents :) dimensions

of the current folder find Finds elements in x

ans Shows last result (x that are equal to i


== i)
path Show / change
search directory x (i, Replaces element in
j) = row i and column j with
addpath Temporarily adds
1 1
folders to the path

which Find the folder of a


function Statistical tests
size Indicates the
[hp] = One sample t test
dimensionality
ttest
(data)

H 0: H0 not rejected,
1: H0 rejected

p p-value

stats.df Degrees of
freedom

stats.tstat t-value

anova Analysis of
variance
Character strings

a = 'Hello' Defines a as
a character
array

j = 'there' Defines j as
a character
array

Greeting = [aj] Adds a and j


together to
'Hello there'

strfind Finds
strings in a
character
array

filename = Defines a
['Dataset_' file name
num2str using
(subjectnumber) strings
'.xls']

num2str Makes a
numeric
vector a
character
vector
Character strings

a = 'Hello' Defines a as
a character
array

j = 'there' Defines j as
a character
array

Greeting = [aj] Adds a and j


together to
'Hello there'

strfind Finds
strings in a
character
array

filename = Defines a
['Dataset_' file name
num2str using
(subjectnumber) strings
'.xls']

num2str Makes a
numeric
vector a
character
vector

You might also like