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

1 visualización (últimos 30 días)
Oleg Komarov
Oleg Komarov el 22 de Oct. de 2014
Respondida: Oleg Komarov el 2 de Nov. de 2014
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')

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 2 de Nov. de 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.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by