27rohitb.github.io

Array

Can hold objects of different types.

NOTE:

Display properly:

display(<array/matrix>)

Creating Empty Array of ANY type:

emty_arr = []

Add ONE element to EMPTY array

push!(empty_arr, 1)
push!(empty_arr, "hello") #possible because of type "ANY"

Concatenate Array(/containers)

append!(arr, arr2)

Update element:

arr[1] = 67

MULIT-Dimensional Access!:

# FOR MULTI-DIMENSIONAL
arr[r,c] # YES, r,c, though IN memory, its column majors!!!!!!

Create a SPECIFIC type array:

<var name> = Array{<Type>}(undef, <lowest dimension>)
x = Array{Int64}(undef, 1) #creates a 1 dimension, 1 element Int64 array

NOTE::


Pre-allocating array

Use the bottom ones and the edit these. Its faster

Create array of zeros:

zeros(2,2)

Create array of ones:

ones(2,2)