I have a matrix of the form:

```
m = 1, 0, 10, 20, 30, 40, 50;
    2, 1, 11, 20, 30, 40, 50;
    3, 0, 12, 20, 30, 40, 50;
    4, 1, 12, 21, 30, 40, 50;

```

For a given column index (say 3) and row index (say 1), I'd like to filter out all rows that have the same values to the right of that column in that row. Using the above example of m, columnIndex = 3, and rowIndex = 1 (noted with asterisks):

```
                  **
f(m, 3) = * 1, 0, 10, 20, 30, 40, 50;    % [20, 30, 40, 50] matches itself, include
            2, 1, 11, 20, 30, 40, 50;    % [20, 30, 40, 50] matches the subvector in row 1, include
            3, 0, 12, 20, 30, 40, 50;    % [20, 30, 40, 50] matches the subvector in row 1, include
            4, 1, 12, 21, 30, 40, 50;    % [21, 30, 40, 50] does NOT match the subvector in row 1, filter this out

```

How can I achieve this behavior? I've tried this, but I'm getting an dimension mismatch error.

```
key = data( rowIndex, columnIndex:end );
filteredData = ( data( :, columnIndex:end ) == key );

```