How to build a robot that can stop at a certain point using an altimeter
have fun playing with the Arduino and some sensors! It is a great platform to learn. For your task, look into the Bosch sensor modules BME280 (pressure with temperature and humidity) or BMP280 (just pressure). You can expect maybe +-1 meter of accuracy. Or check the precision version BME388 that could give you +-50cm. Go to the adafruit shop and try a few of the breakout boards. They provide great library and documentation support.

In order to get absolute altitudes, you need to factor in ambient air pressure. A good source for that are METAR reports issued for aircraft. There are many online sources where you can get the so called altimeter setting for an airport close to you. Airplane altimeters actually just show the altitude above a standard pressure plane, so you need to compensate for whatever pressure the current weather gives you.

For higher precision, you pretty soon have to integrate barometric pressure, GPS altitude, and maybe other sensors, with some serious math. This is where MATLAB fits in.