MATLAB: Do I receive the error ‘Illegal device option’ when using the PRINT command in MATLAB 7.8 (R2009a)

MATLAB

When I execute the following command
print('-dpdf ', 'test.pdf')
I get the error
??? Error using ==> print at 315
Illegal device option, '-dpdf ', specified.
However, no error occurs if I use the following syntax:
print -dpdf test.pdf

Best Answer

This error occurs because of the space in '-dpdf'. The following command does not result in the error:
print('-dpdf', 'test.pdf')
There is an inconsistency in the PRINT command, because the following command, with a space in '-depsc ', also does not result in an error:
print('-depsc ', 'test.eps')