[Bug?] Print to eps on Win produces Unix line endings

1 view (last 30 days)
On Win7 64b with R2014b, printing a figure to .eps produces Unix line endings (LF or \n). Is this expected or a bug?
Also, does it depend on Matlab version?
You can test with:
% Plot and export to .eps
plot(1:10)
print(gcf,'test','-depsc')
fid = fopen('test.eps');
% Check if Unix LF only
line = fgets(fid);
if all(line(end-1:end) == sprintf('\r\n'))
disp('CRLF')
elseif line(end) == sprintf('\n')
disp('LF only!')
end
% Clean up
fclose(fid);
delete('test.eps')

Accepted Answer

Oleg Komarov
Oleg Komarov on 2 Nov 2014
Since R2014b, on Win: it is not a bug but a change in behavior of the print() function.
A workaround is to read in the .eps and regexprep() Unix line endings into Windows ones.

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!