:</p><pre class="codeinput">x = [1;2;3;4;5];
A = opDiag(x); <span class="comment">% Create a 5x5 operator with x's values on its diagonal</span>
B = A(2:4,:);  <span class="comment">% Extract rows 2-4 of A</span>
double(B)
</pre><pre class="codeoutput">
ans =

     0     2     0     0     0
     0     0     3     0     0
     0     0     0     4     0

</pre><p>We can also assign values to a subset of an operator, again using the same syntax as in MATLAB matrices. The row and column indices we specify don't