I think the easiest way is to write a tiny subfunction which converts a logical true and a false to the strings "true" and "false".
function str=log2str(a)
if a
str='true';
else
str='false';
end
Then, the statement is fprintf(fileID,printing,log2str(a1)); Your printing format is fine then.