Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

A "Quick Reference and Things to Try Out" unit is included at the

end of every section. It has all the commands used in this section
and some additional things for you to try out on your own.
Quick Reference
The table below collects all used commands or important concepts
with links to the documentation.

Datetime and Duration Description
Functions and Concepts
datetime Create a datetime array
year, month, day, hour, Extract components of datetime values as
minute, second numeric values
duration Create a duration array
years, days, hours, Create a duration array or return a numerical
minutes, seconds value from a duration array
myDateTime.Format = 'yyyy- Change the format of a datetime array
MM-dd'

myDuration.Format = 's' Change the format of a duration array


Categorical Functions Description
categories Return the categories of a categorical array
addcats, removecats, Add, remove, merge, or rename categories in a
mergecats, renamecats categorical array
Text Functions and Concepts Description
,
extractBefore extractAfter Extract substrings before/after specified
substrings
,
insertBefore insertAfter Insert strings before/after specified substrings
,
erase replace Delete/replace substrings
contains Determine if a string contains a pattern
"Hello" + "World" Concatenate string elements into a single
element
['Hello' 'World'] Concatenate char elements into a single element
Relational and Logical Description
Operators
>, <, >=, <=, ==, ~= Relational operators; compare two values
&, |, ~ Logical operators; combine multiple conditions
(&, |) or negate a condition (~)
Mathematical Operators Description
+, -, .*, ./, .^ Elementwise operators; operate on each element
of an array, individually
*, /, \, ^ Matrix operators; perform matrix math
' Transpose (complex conjugate); switch the rows
and columns of a matrix Hide Notes
Matrix Creation Functions Description
,
zeros ones Create a matrix of zeros/ones
rand Create a matrix of uniformly distributed random
values between 0 and 1
randi Create a matrix of uniformly distributed random
integers
randn Create a matrix of normally distributed random
values
Matrix Visualization Description
Functions
surf Create a surf plot
mesh Create a mesh plot
pcolor Plot matrix data as a grid of colored cells
image Display image from an array
Statistical Functions Description
mean Compute mean (average)
median Compute median
mode Compute mode (most frequent value)
std Compute standard deviation
sum Compute the sum of array elements
Other Functions and Description
Concepts
,
array2table table2array Convert a matrix to a table/Convert a table to a
matrix
... Continue long statements on multiple lines
char Convert an array to a character array
string Convert an array to a string array
double Convert an array to a double array

Things to Try Out


You have applied many new commands and concepts in Section 2.
The table below lists some other useful functions, components, or
concepts to explore if you are interested. You don't need them to
complete the course, but they might come in handy.
Useful Live Editor Tasks Description
Join Tables Live Task Interactively combine two tables in the live
editor
Create Plot Live Task Create and explore visualizations in the live
editor
Functions for Tables Description
,
height width Determine the number of table rows/table Hide Notes
variables
Datetime Functions and Description
Concepts
timeofday Elapsed time since midnight
isweekend Determine whether datetime values are on a
weekend
isbetween Determine whether datetime values are
within a specified interval
now Current date and time
datetime("yesterday"), Create a datetime variable with yesterday's,
datetime("today"), today's, or tomorrow's date
datetime("tomorrow")

Logical Functions Description


xor Find logical exclusive-OR
logical Convert numeric value to logical
any Determine if at least one element in an array
is nonzero or true

Previous Next

All Rights Reserved

edX
About
Affiliates
edX for Business
Open edX
Careers
News
Legal
Terms of Service & Honor Code
Privacy Policy
Accessibility Policy
Trademark Policy
Sitemap
Connect
Blog
Contact Us
Help Center
Hide Notes

You might also like