Julia for MATLAB Users/Core Language/Language Fundamentals

= Language Fundamentals =

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.

Entering Commands
Related: Julia REPL

Most recent answer
Julia's is functionally basically identical, though note that it is available only at the REPL.

Clear Command Window
Ctrl 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 command in shell mode, i.e. ;.

Command Window text to file
There doesn't appear to be an equivalent Julia REPL command.

Set Command Window output display format
There is no drop-in equivalent in the Julia REPL or IJulia for globally setting the output format.

Send cursor home
Ctrl is functionally equivalent in the Julia REPL.

Determine whether input is MATLAB keyword
There doesn't appear to be an equivalent Julia command, but see Keywords in the Julia manual.

Matrices and Arrays
See Multi-dimensional Arrays in the Julia Manual.

Create array of all zeros; Create array of all ones
Julia's and  are functionally equivalent. Note that the syntax for specifying the data type of the result is different, e.g. Julia:  vs. MATLAB.

Uniformly distributed random numbers
See Julia's.

Identity matrix
In Julia to construct a numeric identity matrix, use something like. Note that the symbol  is special in Julia; rather than representing a matrix, it is an instance of the   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.

Concatenate arrays horizontally
See Julia's hcat function

Length of largest array dimension
Julia has a  function, however it does not operate the same way as Matlab's for multidimensional arrays. To get equivalent behavior to Matlab's, use   in Julia.

Number of array dimensions
In Julia, is similar but not identical. For instance, Julia does not ignore singleton dimensions.

Number of array elements
In Julia, is equivalent.

Remove singleton dimensions
Julia's function is similar though it requires the singleton dimension(s) to be specified explicitly.

Terminate block of code, or indicate last array index
Julia's  is basically equivalent.

Operators and Elementary Operations
See Mathematical Operations and Elementary Functions in the Julia manual.

Find indices and values of nonzero elements
In Julia, provides similar functionality. See also, ,  and.

Data Types
See Types in the Julia manual.