Oh, I think I might just have found the answer to my own question. The command set(gcf,'units','centimeters') should be set(gcf,'paperunits','centimeters') instead.
The output doesn't seem to be exactly the size that I specify, but now at least it is pretty close!