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

1 visualizzazione (ultimi 30 giorni)
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')

Risposta accettata

Oleg Komarov
Oleg Komarov il 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.

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by