accessing-pieces-arrays/quickref.tex
changeset 285 7c4855fb8e5f
parent 217 b595f90016c5
equal deleted inserted replaced
284:55342d3c9d25 285:7c4855fb8e5f
     1 Creating a linear array:\\
     1 \textbf{Accessing parts of arrays}
     2 {\ex \lstinline|    x = linspace(0, 2*pi, 50)|}
       
     3 
     2 
     4 Plotting two variables:\\
     3 \lstinline|C[i-1, j-1]| to access element i, j in C (mxn).
     5 {\ex \lstinline|    plot(x, sin(x))|}
     4 \lstinline|C[i-1]| to access i^{th} row
       
     5 \lstinline|C[:, j-1]| to access j^{th} column
     6 
     6 
     7 Plotting two lists of equal length x, y:\\
     7 Assigning to accessed elements, changes them. 
     8 {\ex \lstinline|    plot(x, y)|}
     8 
       
     9 \lstinline|A[m:n:o]| accesses the rows from \lstinline|m|
       
    10 to \lstinline|n| (excluded) in steps of \lstinline|o|
       
    11 
       
    12 Similarly, \lstinline|C[m:n:o, p:q:r]|