# dropOperator done on Matrix of a Matrix - How is this done?

I have implemented this dropOperator from dropOperator from stackexchange and works fine on a single Matrix. But now I have a Matrix of a Matrix and want to drop some rows or columns (in the pic below f.e row 2,5,7) of Matrixes of that Matrix-Matrix. It seems that this could not be done with that dropOperator described in the above link.

This should work:

It is not clear why you need special functions to do what you want instead of using Drop. I think you should provide a minimum working example of your starting "matrix of matrix" and what you want the end result to be.

In any case try this:

m = Array[FromDigits[{##}] &, {3, 3, 4}]

Drop[m, {2}] // MatrixForm

Drop[m, None, {2}] // MatrixForm


Edit

Here is a starting point that seems to be a similar form to yours:

m = Array[FromDigits[{##}] &, {9, 4, 6, 2}];
MatrixForm[m]


So to drop rows 2, 5, and 7:

Part[m, {1, 3, 4, 6, 8, 9}] // MatrixForm


unevenDropRow[m_, pos_] := Part[m, Complement[Range[Length[m]], pos]]
unevenDropCol[m_, pos_] := Part[m, All, Complement[Range[Length[m[[1]]]], pos]]


Note that the above are specific for the problem you have raised. They may need to be expanded/generalised depending on how typical this is of your usage. You can combine the row and column drops into one:

unevenDrop[m_, rowpos_, colpos_] := Part[m, Complement[Range[Length[m]], rowpos],
Complement[Range[Length[m[[1]]]], colpos]]

unevenDrop[m, {2, 5, 7}, {2, 3}] // MatrixForm

• Thanks a Lot, that was it I was looking for! Nov 24 '14 at 10:58