Update main.cpp

made samplematrix and referencematrix variables global.