ksohan
ksohan

Reputation: 1203

Can not create pdf file in matlab

I am running the following script to create pdf file.

%% Plotting confusion matrix
if(opt == 1)
    plotconfusion_mod(y(:,1:2)',y(:,3:4)');
elseif(opt == 2)
    plotconfusion_mod(y(:,1:4)',y(:,5:8)');
elseif(opt == 3)
    plotconfusion_mod(y(:,1:10)',y(:,11:20)');
    set(gcf,'position',[100, -100, 800, 800])
end
set(gcf,'Units','inches'); screenposition = get(gcf,'Position');
set(gcf,'PaperPosition',[0 0 screenposition(3:4)],'PaperSize',screenposition(3:4));

%% Saving
Q = input('Do you want to save the results (Y/N)\n','s');
if(Q == 'y' || Q == 'Y')
    print(1,['confusion_matrix_' num2str(opt)],'-dpdf','-r512');
else
    return
end

But I am getting the following error on Windows operating system.

Error using name (line 102)
Cannot create output file '.\snippet_1.pdf'.

Error in print (line 85)
    pj = name( pj );

Can anyone help with it please?

The value of opt is 1.

Upvotes: 0

Views: 77

Answers (1)

tyogi
tyogi

Reputation: 650

Given the comments, the problem is due to the OP accessing a directory without permissions. Several answers might be appropriate in this case but likely require knowing more about the system (Linux, Windows, Mac, which directory, etc.). However, I feel like the easiest way to avoid such hassles is to simply move your code into a sub-directory that is in your HOME directory.

HOME directory might mean different things depending on your system, but it is usually the one that contains your "documents" folder.

If you do not want to move the codebase for some reason, you wil require assistance with changing permissions and are best off asking in system-specific forum or with system-specific tags.

Upvotes: 2

Related Questions