Rectangle find matlab prototype