Validation for Matrix