Skip to content
Snippets Groups Projects
Commit 5b178526 authored by giuliaghirardini's avatar giuliaghirardini Committed by Marco Luigi Gaibotti
Browse files

[export-standardized-figure][utilities] Modified exporting pdf method in function

parent 5ecce1c7
No related branches found
No related tags found
No related merge requests found
...@@ -439,7 +439,6 @@ end ...@@ -439,7 +439,6 @@ end
%% export %% export
% Export PDF % Export PDF
if p.Results.exportPDF if p.Results.exportPDF
% Costruisci il nome del file
figPath = p.Results.figurePath; figPath = p.Results.figurePath;
if ~isempty(figPath) && ~(strcmp(figPath(end), '\') || strcmp(figPath(end), '/')) if ~isempty(figPath) && ~(strcmp(figPath(end), '\') || strcmp(figPath(end), '/'))
figPath = strcat(figPath, '\'); figPath = strcat(figPath, '\');
...@@ -449,12 +448,10 @@ if p.Results.exportPDF ...@@ -449,12 +448,10 @@ if p.Results.exportPDF
s1 = string(strcat(figPath, figureName, '.pdf')); s1 = string(strcat(figPath, figureName, '.pdf'));
% Verifica il tipo di s1 if isempty(s1)
if ~ischar(s1) && ~isstring(s1)
error('Invalid file name or path.'); error('Invalid file name or path.');
end end
% Controllo di esistenza e salvataggio
if exist(s1, 'file') == 0 || p.Results.overwriteFigure if exist(s1, 'file') == 0 || p.Results.overwriteFigure
exportgraphics(f, s1, "ContentType", "vector"); exportgraphics(f, s1, "ContentType", "vector");
else else
...@@ -463,9 +460,14 @@ if p.Results.exportPDF ...@@ -463,9 +460,14 @@ if p.Results.exportPDF
exportgraphics(f, s2, "ContentType", "vector"); exportgraphics(f, s2, "ContentType", "vector");
warning('figure named ''%s'' instead of ''%s''', s2, s1); warning('figure named ''%s'' instead of ''%s''', s2, s1);
end end
end
fprintf('Figure saved successfully!\n\ntext to copy:\n')
latexstr = strcat('\includegraphics[width=',num2str(percTextwidth,2),...
'\textwidth]{<add figure path>\',figureName,'.pdf}');
disp(latexstr)
end
% Export FIG
if p.Results.exportFIG if p.Results.exportFIG
s1 = strcat(figPath, figureName, '.fig'); s1 = strcat(figPath, figureName, '.fig');
if p.Results.overwriteFigure || exist(s1,"file")==0 if p.Results.overwriteFigure || exist(s1,"file")==0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment