diff -r 55342d3c9d25 -r 7c4855fb8e5f accessing-pieces-arrays/quickref.tex --- a/accessing-pieces-arrays/quickref.tex Mon Oct 11 01:25:45 2010 +0530 +++ b/accessing-pieces-arrays/quickref.tex Mon Oct 11 11:40:04 2010 +0530 @@ -1,8 +1,12 @@ -Creating a linear array:\\ -{\ex \lstinline| x = linspace(0, 2*pi, 50)|} +\textbf{Accessing parts of arrays} + +\lstinline|C[i-1, j-1]| to access element i, j in C (mxn). +\lstinline|C[i-1]| to access i^{th} row +\lstinline|C[:, j-1]| to access j^{th} column -Plotting two variables:\\ -{\ex \lstinline| plot(x, sin(x))|} +Assigning to accessed elements, changes them. -Plotting two lists of equal length x, y:\\ -{\ex \lstinline| plot(x, y)|} +\lstinline|A[m:n:o]| accesses the rows from \lstinline|m| +to \lstinline|n| (excluded) in steps of \lstinline|o| + +Similarly, \lstinline|C[m:n:o, p:q:r]|