How to create a distance matrix using the HC-SR04 sensor?

I found a serial port program that reads serial port data. and write it to a file.