From b11413f018cf23444aef60906d752b074d541c86 Mon Sep 17 00:00:00 2001 From: quirksahern Date: Thu, 14 Nov 2024 12:28:51 +0100 Subject: [PATCH] Update 02-arrays.md added info that Matlab starts indexes on 1, and a labelled image. --- episodes/02-arrays.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/episodes/02-arrays.md b/episodes/02-arrays.md index 7e967486..5d5d8b03 100644 --- a/episodes/02-arrays.md +++ b/episodes/02-arrays.md @@ -59,8 +59,10 @@ its [index](../learners/reference.md#index) in parentheses: ans = 38 ``` -Indices are provided as (row, column). So the index `(5, 6)` selects the element -on the fifth row and sixth column. +Indices are provided as (row, column). In Matlab, indexing starts at 1. +So the index `(5, 6)` selects the element on the fifth row and sixth column. + +![](fig/Matlab_Array_Indexes.svg){alt='8-by-8 matrix with rows for each label and column indicating their number. Rows numbered 1 to 8, as are columns'} An index like `(5, 6)` selects a single element of an array, but we can also access sections of the matrix, or [slices](../learners/reference.md#slice).