MATLAB: Print Function – Error

inputcheckprint

Hello,
I've posted to this forum previously; I've inherited an old .m file (10 year old code) for vehicle dynamics that I'm trying to make more robust and efficient. I'm receiving tons of errors, but I'm slowly sorting through them.
This error involves a print function that prints each figure (a total of 12 figs) and creates a .ps file and a summary text file. I've tried debugging the error, but I'm not able to fix it.
Here is the code that follows each plot:
if 1i==1,
eval(['print -dpsc ' prfile]);
else
% eval(['print -dpsc -append ' prfile]);
end
Here is the error:
??? Error using ==> inputcheck at
34
Multiple inputs that look like
filenames: 'C:
Error in ==> print at 163
[pj, devices, options ] =
inputcheck( pj, inputargs{:} );
Error in ==> OC_N1_rev1 at 520
eval(['print -dps -append '
prfile]);
I can paste more code if you need it to dissect the problem further.
If there is code to bypass the .ps file and go to .pdf that would be much better. Again, I'm not very strong on the programming side of matlab.
Thanks for you help!

Best Answer

Convert to this:
if 1i==1,
print('-dpsc',prfile);
else
% print('-dpsc', '-append', prfile);
end
Your difficulty is that before the code was not expected to work with directories or files that had spaces in the name, and now you expect it to do that. The altered code will work with either kind of name.