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

To troubleshoot, you can't look at end to end results. You have to split the problem in two so you can decide whether the problem is with your sending or receiving code. On the PC side, use a terminal emulator to capture and display the raw serial data from the Arduino.