It turns out that '%' needs to be written as '%%' in the string (thank you Honglei Chen), and that was somehow interfering with my newline working as well. In the end I used
entry = sprintf('%%* < >\n');
which produces
% * < >
plus a newline. If you use '%s', I guess it interprets every character as itself:
Best Answer