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

조회 수: 1 (최근 30일)
Oleg Komarov
Oleg Komarov 2014년 10월 22일
답변: Oleg Komarov 2014년 11월 2일
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