Copy figure to clipboard

조회 수: 10 (최근 30일)
Jason
Jason 2014년 12월 11일
댓글: denny 2018년 5월 13일
I have a pushbutton on a gui that calls a seperate function. In this function I create a figure and perform four suplots.
The figure is create via:
hFig = figure('Name','Histograms from gtc Files', 'Resize','on', 'Position',[400 100 1000 800],'numbertitle','off','visible','on');
movegui(hFig,'center')
After the subplot are plotteds, I want to autosave the whole figure and copy to clipboard. (hardcoded within my function.)
The autosave works after reading how to do it:
hgexport(hFig, savepath, hgexport('factorystyle'), 'Format', 'jpeg');
But I cannot get the copy to clipboard to work. I have tried both
%Copy to clipboard
print -dmeta -noui
and this approach
hCopyFigure = findobj(hFig,'Label','Copy &Figure'); %# Handle for the "Copy
%# Figure" menu item
get(hCopyFigure,'Callback')
editmenufcn(gcbf,'EditCopyFigure')
I can't find anywhere that shows a clear way to do it. Thanks Jason

채택된 답변

Sean de Wolski
Sean de Wolski 2014년 12월 11일
편집: Sean de Wolski 2014년 12월 11일
>> print -clipboard -dbitmap
Or
>> print -clipboard -dmeta

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 12월 11일
MATLAB's clipboard() function can't handle it, but leave it to Yair to find a way:
  댓글 수: 3
Jason
Jason 2014년 12월 11일
편집: Jason 2014년 12월 11일
This works!!!
hgexport(hFig,'-clipboard')
denny
denny 2018년 5월 13일
Great!

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by