This page maps MATLAB functionality documented in the Language Fundamentals section of the MATLAB documentation to equivalent Julia (core language and/or package) functionality.
Another helpful resource is the noteworthy differences from MATLAB section of the Julia documentation.
Related: Julia REPL
Julia's ans
is functionally basically identical, though note that it is available only at the REPL.
Ctrl+L is nearly equivalent in the Julia REPL, though it does not erase history; you can still scroll up to see the history of the session. You can also equivalently (on Linux/Mac) run the clear(1)
command in shell mode, i.e. ;+clear.
There doesn't appear to be an equivalent Julia REPL command.
There is no drop-in equivalent in the Julia REPL or IJulia for globally setting the output format.
Ctrl+L is functionally equivalent in the Julia REPL.
There doesn't appear to be an equivalent Julia command, but see Keywords in the Julia manual.
more
Control paged output for Command Window
edit
See Multi-dimensional Arrays in the Julia Manual.
zeros
Create array of all zeros; ones
Create array of all ones
edit
Julia's zeros
and ones
are functionally equivalent. Note that the syntax for specifying the data type of the result is different, e.g. Julia: zeros(Int64, 3, 3)
vs. MATLAB zeros(3,3, 'int64')
.
See Julia's rand
.
In Julia to construct a numeric identity matrix, use something like Matrix(1.0I, 3, 3)
. Note that the symbol I
is special in Julia; rather than representing a matrix, it is an instance of the UniformScaling
operator so that in principle its use can be more efficient than the naive use of a dense matrix that happens to have 1's on the diagonal and zeros elsewhere.
diag
Create diagonal matrix or get diagonal elements of matrix
edit
cat
Concatenate arrays along specified dimension
edit
See Julia's hcat function
Julia has a length
function, however it does not operate the same way as Matlab's for multidimensional arrays. To get equivalent behavior to Matlab's length(X)
, use maximum(size(X))
in Julia.
In Julia, ndims
is similar but not identical. For instance, Julia does not ignore singleton dimensions.
In Julia, length
is equivalent.
Julia's dropdims
function is similar though it requires the singleton dimension(s) to be specified explicitly.
colon
Vector creation, array subscripting, and for-loop iteration
edit
end
Terminate block of code, or indicate last array index
edit
Julia's end
is basically equivalent.
Operators and Elementary Operations
edit
See Mathematical Operations and Elementary Functions in the Julia manual.
mrdivide
Solve systems of linear equations xA = B for x
edit
mldivide
Solve systems of linear equations Ax = B for x
edit
diff
Differences and Approximate Derivatives
edit
ceil
Round toward positive infinity
edit
mod
Remainder after division (modulo operation)
edit
round
Round to nearest decimal or integer
edit
bsxfun
Apply element-wise operation to two arrays with implicit expansion enabled
edit
Relational Operations
edit
ge
Determine greater than or equal to
edit
gt
Determine greater than
edit
le
Determine less than or equal to
edit
isequaln
Determine array equality, treating NaN values as equal
edit
Logical Operators: Short-circuit Logical operations with short-circuiting
edit
all
Determine if all array elements are nonzero or true
edit
any
Determine if any array elements are nonzero
edit
find
Find indices and values of nonzero elements
edit
In Julia, findall
provides similar functionality. See also findfirst
, findlast
, findnext
and findprev
.
See Types in the Julia manual.
cast
Cast variable to different data type
edit
typecast
Convert data types without changing underlying data
edit
eps
Floating-point relative accuracy
edit
intmax
Largest value of specified integer type
edit
intmin
Smallest value of specified integer type
edit
realmin
Smallest positive normalized floating-point number
edit
Characters and Strings
edit
strings
Create array of strings with no characters
edit
cellstr
Convert to cell array of character vectors
edit
isspace
Determine which characters are space characters
edit
count
Count occurrences of pattern in string
edit
replace
Find and replace substrings in string array
edit
rEplacebetween
Replace substrings identified by indicators that mark their starts and ends
edit
erasebetween
Delete substrings between indicators that mark starts and ends of substrings
edit
eXtractbetween
Extract substrings between indicators that mark starts and ends of substrings
edit
pad
Add leading or trailing characters to strings
edit
strip
Remove leading and trailing characters from string
edit
deblank
Remove trailing whitespace from end of string or character array
edit
strtrim
Remove leading and trailing whitespace from string array or character array
edit
strncmp
Compare first n characters of strings (case sensitive)
edit
strncmpi
Compare first n characters of strings (case insensitive)
edit
regexp
Match regular expression (case sensitive)
edit
regexpi
Match regular expression (case insensitive)
edit
ymd
Year, month, and day numbers of datetime
edit
hms
Hour, minute, and second numbers of duration
edit
split
Split calendar duration into numeric and duration units
edit
time
Convert time of calendar duration to duration
edit
isnat
Determine NaT (Not-a-Time) elements
edit
isdst
Determine daylight saving time elements
edit
datenum
Convert date and time to serial date number
edit
datevec
Convert date and time to vector of components
edit
yyyymmdd
Convert MATLAB datetime to YYYYMMDD numeric value
edit
now
Current date and time as serial date number
edit
clock
Current date and time as date vector
edit
isprotected
Determine whether categories of categorical array are protected
edit
countcats
Count occurrences of categorical array elements by category
edit
table
Table array with named variables that can contain different types
edit
stack
Stack data from multiple variables into single variable
edit
unstack
Unstack data from single variable into multiple variables
edit
fieldnames
Field names of structure, or public fields of COM or Java object
edit
cell2mat
Convert cell array to ordinary array of the underlying data type
edit
cellstr
Convert to cell array of character vectors
edit
mat2cell
Convert array to cell array with potentially different sized cells
edit
num2cell
Convert array to cell array with consistently sized cells
edit
func2str
Construct character vector from function handle
edit
str2func
Construct function handle from character vector
edit
isKey
Determine if Map object contains key
edit
remove
Delete key-value pairs from Map object
edit
append
Concatenate timeseries objects in time
edit
detrend
Subtract mean or best-fit line from timeseries object
edit
filter
Modify frequency content of timeseries objects
edit
synchronize
Synchronize and resample two timeseries objects using common time vector
edit
get
Query timeseries properties
edit
iqr
Interquartile range of timeseries data
edit
max
Maximum of timeseries data
edit
min
Minimum of timeseries data
edit
std
Standard deviation of timeseries data
edit
var
Variance of timeseries data
edit
Time Series Collections
edit
horzcat
Horizontally concatenate tscollection objects
edit
set
Set tscollection properties
edit
vertcat
Vertically concatenate tscollection objects
edit
get
Query tscollection properties
edit
get
Query tsdata.event properties
edit
set
Set tsdata.event properties
edit
Data Type Identification
edit
whos
List variables in workspace, with sizes and types
edit
Data Type Conversion
edit
cellstr
Convert to cell array of character vectors
edit
base2dec
Convert text representing number in base N to decimal number
edit
bin2dec
Convert text representation of binary number to decimal number
edit
dec2base
Convert decimal number to character vector representing base N number
edit
dec2bin
Convert decimal number to character vector representing binary number
edit
dec2hex
Convert decimal number to character vector representing hexadecimal number
edit
hex2dec
Convert text representation of hexadecimal number to decimal number
edit
hex2num
Convert IEEE hexadecimal string to double-precision number
edit
num2hex
Convert singles and doubles to IEEE hexadecimal strings
edit
cell2mat
Convert cell array to ordinary array of the underlying data type
edit
mat2cell
Convert array to cell array with potentially different sized cells
edit
num2cell
Convert array to cell array with consistently sized cells
edit