save plot in folder
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, In order to save some time writing my thesis I would like to make an function that has an input the folder name and the figure name in order to save automatically the plots from matlab. Normally I save using the command:
print('-depsc','C:\Users\Lenovo\Dropbox\THESIS\Latex\graphics\Chap2\wind.eps');
Can you please help me how I can write the function? I tried this but does not work.
function [ output_args ] = saveAsEps( folderName, fileName )
eval(['print -depsc ,C:\Users\Lenovo\Dropbox\THESIS\Latex\graphics\,'num2str(folderName),'\',num2str(fileName)','.eps']);
end
Thanks!
0 Commenti
Risposte (2)
Image Analyst
il 3 Mag 2015
Don't use eval.
See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions. where it says to use export_fig().
0 Commenti
Jan
il 3 Mag 2015
"It doesn't work" is not a useful description. Better post the error messages or explain the difference between the results and your expectations.
What about this:
function saveAsEps(folderName, fileName)
print('-depsc', ...
fullfile('C:\Users\Lenovo\Dropbox\THESIS\Latex\graphics\', ...
folderName, [fileName, '.eps']));
end
Avoid eval under all circumstances, because there is always a better method. num2str is not useful here - most likely. There was a comma in the path inside the eval argument.
Vedere anche
Categorie
Scopri di più su Data Type Conversion in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!