# 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

###### ans Most recent answer

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

###### clc Clear Command Window

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.

###### save Command Window text to file

There doesn't appear to be an equivalent Julia REPL command.

###### format Set Command Window output display format

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

###### home Send cursor home

Ctrl+L is functionally equivalent in the Julia REPL.

###### iskeyword Determine whether input is MATLAB keyword

There doesn't appear to be an equivalent Julia command, but see Keywords in the Julia manual.

###### more Control paged output for Command Window
## Matrices and Arrays

See Multi-dimensional Arrays in the Julia Manual.

###### zeros Create array of all zeros; ones Create array of all ones

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').

###### rand Uniformly distributed random numbers

See Julia's rand.

###### eye Identity matrix

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.

###### horzcat Concatenate arrays horizontally

See Julia's hcat function

###### length Length of largest array dimension

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.

###### ndims Number of array dimensions

In Julia, ndims is similar but not identical. For instance, Julia does not ignore singleton dimensions.

###### numel Number of array elements

In Julia, length is equivalent.

###### squeeze Remove singleton dimensions

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

###### end Terminate block of code, or indicate last array index

Julia's end is basically equivalent.

###### sub2ind Convert subscripts to linear indices
## Operators and Elementary Operations

See Mathematical Operations and Elementary Functions in the Julia manual.

### Logical Operations
#### Logical Operators: Short-circuit Logical operations with short-circuiting
###### find Find indices and values of nonzero elements

In Julia, findall provides similar functionality. See also findfirst, findlast, findnext and findprev.

###### true Logical 1 (true)
### Set Operations
#### outerjoin Outer join between two tables or timetables
### Bit-Wise Operations
#### swapbytes Swap byte ordering
## Data Types

See Types in the Julia manual.