take parts of matrix