Bruno and I show how you can determine the name of a variable that you pass to a function.
So what you can do is put your logic into a function, and pass the variables into the function to be operated on. Then when you have calculated the index of the variable that was used, you can pass the index value to inputname() to find out what the variable name was.
Coding in this manner permits you to only write the names of the variables as references to their values, instead of doing that and creating a cell array of character vectors (or a string array) that has the variable names as quoted strings the way that Stephen shows.
This approach is not recommended; what is recommended is to use a table of names the way that Stephen shows. One advantage of using a table of names is that if you do so you are not restricted to the format of MATLAB variable names. You could for example use table entries such as 'CO2 nmol/s'