MATLAB: How to write percentage sign into a txt file

fprintfMATLAB

I'm trying to generate an html file using fprintf. The issue is that % is causing lots of issues, because it is used by the system to detect the type of the info (integer, text, etc.). So how do I get around the issue?
fprintf(fid, '<td width="20%">%s</td>\n', B{i,2});

Best Answer

Leon - try using two %
fprintf(fid, '<td width="20%%">%s</td>\n', B{i,2});
See the special characters section from fprintf.