MATLAB Answers

0

Print Error - Cannot open file: permission denied.

Asked by Jennifer on 17 Oct 2011

Hello all,

   I'm getting an error sporadically when I'm running my program. I generate multiple plots and save them using a command like:

print('-dpsc2','-r144', [OutputString '_Sinkage_and_Pitch_VS_Ship_Speed'])

Sometime it runs fine, other times I can't get the first plots saved, and other times it stops after a few plots. I just simply run the program again and usually after 2~3 attempts, I don't get an error and it runs just fine. I'm wondering if anyone would have any insight as to why I'm getting this error.

Error:

??? Error using ==> print>LocalPrint at 286 .\RES_A_Total_Resistance_and_Effective_Power_VS_Ship_Speed.ps: Cannot open file: permission denied.

Error in ==> print at 228 LocalPrint(pj);

Thanks.

  1 Comment

Are you printing to a network or external storage drive? Do you have full permissions to the directory? What OS are you using?

Log in to comment.

Tags

1 Answer

Answer by Jason Ross
on 19 Oct 2011

I would look into Daniel's permission question, and also check the amount of:

  • Temp / swap space on your machine
  • Disk space on your machine
  • Disk space on the network resource (if you are saving to a network resource)

  4 Comments

Show 1 older comment

Is "myfilename" different at each iteration through the loop? Did you specify "tp16929d95_5949_4929_b853_6359e964bd51.ps" or is that a name it made up and you actually used something different?

@Peter, You might be better off posting this as a new question. As for an answer, what are all the ~ doing in the path? I think on Windows the maximum path length + filename length is 255, how long is your path?

@Image Analyst: the file name 'myfilename' does change on each iteration, but the only thing that changes is a few characters (i.e., the path, basic file name format and length, and file extension all remain the same). The post-script file is (AFAIK) a temp file created by the built-in MATLAB function 'print.m' or one of its subfunctions - something I don't have control over. I can't find any similarly-named file on my machine. Note that I'm using the 'recycle off' function at the start of my code, because before I did that similar temporary post-script files were being sent to my recycle bin rather than just being deleted after the .pdf file was created.

@Daniel: I'll try posting as an original question. Per the path issue, I was just trying to eliminate folder names so that just the filename (and not the path) on my computer was visible - sorry if it's not correct computer-ese. Both of those file paths are fine in terms of length; the one is simply where MATLAB installed the built-in 'print.m' file and the other is just a temp folder created by Windows XP (both something I don't have control over).

Log in to comment.


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!