Print Function - Error

15 次查看(过去 30 天)
Brent
Brent 2011-6-2
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!

采纳的回答

Walter Roberson
Walter Roberson 2011-6-2
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.

更多回答(2 个)

Nirmal Gunaseelan
The error message seems to suggest that the file name is incomplete.
??? Error using ==> inputcheck at
34
Multiple inputs that look like
filenames: 'C:
So in your code does prfile contain the path to the file name? Maybe you are missing a ' ' to make sure it has the entire individual path?

Fangjun Jiang
Fangjun Jiang 2011-6-2
You may be able to create a .pdf file directly from print() function depending on your Matlab version. Check your document:
doc print

类别

Help CenterFile Exchange 中查找有关 Variables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by