The ‘%d’ format descriptor writes integers, and since ‘0.15’ is not an integer, it defaults to an exponential format.
Try this:
fprintf(fid,'%.2f\n',R2');
The ‘%f’ format descriptor writes either fixed-width or variable-width floating point numbers, depending on what you want. See the documentation on fprintf for details.