Fixed bug by changing pointsM = [pointsM planC{inde... to pointsM = [pointsM; planC{inde...