User guide
14-3
3
2
1
indexesthe[3,2,1]elementofx.A2x1vectorofindicesforthis3-dimensionalexample,
referencesthe1-dimensionalarraywhosestartinglocationisgivenbytheindices.
Becausetheelementsofthevectorofindicesarealwaysinthesameorder(thefirstele-
mentofthevectorofindicescorrespondstotheslowestmovingdimensionofthearray,
thesecondelementtothesecondslowestmovingdimension,andsoon),eachunique
vectorofindiceslocatesauniquesubarray.
Ingeneral,an[N-K]x1vectorofindiceslocatesaK-dimensionalsubarraythatbeginsat
thepositionindicatedbytheindices.ThesizesofthedimensionsoftheK-dimensional
subarraycorrespondtothelastKelementsofthevectorofordersoftheN-dimensional
array.Fora6x5x4x3x2arrayy,the2x1vectorofindices:
2
5
locatesthe4x3x2subarrayinythatbeginsat[2,5,1,1,1]andendsat[2,5,4,3,2].
14.1 Bracketed Indexing
Brackets'[]'canbeusedtoindexN-dimensionalarraysinvirtuallythesamewaythat
theyareusedtoindexmatrices.Bracketedindexingisslowerthantheconvenience
arrayfunctions,suchasgetarrayandsetarray;however,itcanbeusedtoindex
non-contiguouselements.InordertoindexanN-dimensionalarraywithbrackets,there
mustbeNindiceslocatedwithinthebrackets,wherethefirstindexcorrespondstothe
slowestmovingdimensionofthearrayandthelastindexcorrespondstothefastestmov-
ingdimension.
Fora2x3x4arrayx,suchthat:
N-Dimensional Arrays










