How to write percentage sign into a txt file

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});

1 Comment

"So how do I get around the issue?"
By reading the fprintf help and looking at the table of special characters.

Sign in to comment.

 Accepted Answer

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

More Answers (0)

Products

Tags

Asked:

on 9 Jan 2018

Commented:

on 9 Jan 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!