You can loop through each element of the matrix and check if the row index is greater than 2. If it is, then set the value of that element to zero. Here's an example code to do that:
main.m419 chars20 lines
This code will replace the elements in rows greater than 2 with zeros. The output of this code would be:
main.m60 chars5 lines
Hope this helps!
gistlibby LogSnag