Print figure to a specific path
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
JP Connors
am 6 Apr. 2017
Kommentiert: JP Connors
am 8 Apr. 2017
Hi,
I'm using MATLAB version R2016a on a Mac and I'm having trouble printing a figure to a different directory than the current one. Could someone please help me fix my mistake? I have tried the following code:
print('Ult_Stress_vs_Temp','-dpng','/Users/Tim/Documents/2-Grad-School/Research/Technical-Paper/Latex/Figures/')
This is the error message I receive:
Error using inputcheck (line 40)
Multiple inputs that look like file names: 'Ult_Stress_vs_Temp' and
'/Users/Tim/Documents/2-Grad-School/Research/Technical-Paper/Latex/Figures/'.
Error in print (line 41)
[pj, devices, options ] = inputcheck( pj, inputargs{:} );
Error in ult_stress_temp_plot (line 47)
print('Ult_Stress_vs_Temp','-dpng','/Users/Tim/Documents/2-Grad-School/Research/Technical-Paper/Latex/Figures/')
>>
0 Kommentare
Akzeptierte Antwort
Les Beckham
am 6 Apr. 2017
You need to pass a handle to the figure you wish to print. The parameter 'Ult_Stress_vs_Temp' is, I assume, maybe the title of the plot? This will not work. Ideally you will have created a handle to the figure when you created it (hfig = figure; plot(x,y), or similar).
You then print as: print(hfig, '-dpng', '/Users/Tim/Documents/2-Grad-School/Research/Technical-Paper/Latex/Figures/Ult_Stress_vs_Temp.png'). Note that you need to provide the filename, not just a folder location.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Report Generator finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!