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

1 次查看(过去 30 天)
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')

采纳的回答

Oleg Komarov
Oleg Komarov 2014-11-2
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by