Print figure to a specific path

조회 수: 16 (최근 30일)
JP Connors
JP Connors 2017년 4월 6일
댓글: JP Connors 2017년 4월 8일
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/')
>>

채택된 답변

Les Beckham
Les Beckham 2017년 4월 6일
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.
  댓글 수: 1
JP Connors
JP Connors 2017년 4월 8일
Thanks for your help!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by