In [68]:
#Array declaration
a = [1,4,2,9,3,5]
Out[68]:
In [69]:
b = [1 4 2 7 3 5]
Out[69]:
In [70]:
c = [1 2; 2 4; 5 6]
Out[70]:
In [71]:
# ndims returns the number of dimensions of an array
ndims(c)
Out[71]:
In [72]:
# size returns a tuple with the dimensions of an array
size(c)
Out[72]:
In [73]:
#Returns a subset of array
getindex(a, 2:3)
Out[73]:
In [74]:
# the view function is like getindex(), but returns a view into the parent array with the given indices instead of making a copy.
x =view(a, 2:3)
Out[74]:
In [75]:
#Creates a SubArray from an indexing expression, should not be used as the target of an assignment (e.g. @view(A[1,2:end]) = ...)
@view a[2:end]
Out[75]:
In [76]:
#parent returns the ”parent array” of an array view type
parent(x)
Out[76]:
In [77]:
# parentindexes returns the corresponding indexes in the parent
parentindexes(x)
Out[77]:
In [78]:
# slicedim() return all the data where the index for dimension d equals i
slicedim(c,1,2)
Out[78]:
In [79]:
# setindex!(A, X, inds...) stores values from array X within some subset of A as specified by
y = [7,8]
setindex!(a, y,2:3)
Out[79]:
In [81]:
# isassigned(array, i) tests whether the given array has a value associated with index i
isassigned(a, 10)
Out[81]:
In [83]:
# vcat(A...) concatenates along dimension 1
Out[83]:
In [ ]: