This thread went all kinds of crazy. I don't have MATLAB, but because power is measured in Watts (or milliWatts as the case may be), if you want the dBm value that tells you the attenuation or gain of the signal, you have to use 10 log(Output/Input). If you are calculating using voltage or current, the formula is 20 log (Output/Input) because power is proportional to the square of the signal's amplitude (voltage). The logarithmic squares law applies.
In addition, if you would like the most recent comments to be split off into their own thread and continue the discussion there, please contact a member of the moderation team and we can do that for you.