Copy figure to clipboard

10 Ansichten (letzte 30 Tage)
Jason
Jason am 11 Dez. 2014
Kommentiert: denny am 13 Mai 2018
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

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 11 Dez. 2014
Bearbeitet: Sean de Wolski am 11 Dez. 2014
>> print -clipboard -dbitmap
Or
>> print -clipboard -dmeta

Weitere Antworten (1)

Image Analyst
Image Analyst am 11 Dez. 2014
MATLAB's clipboard() function can't handle it, but leave it to Yair to find a way:
  3 Kommentare
Jason
Jason am 11 Dez. 2014
Bearbeitet: Jason am 11 Dez. 2014
This works!!!
hgexport(hFig,'-clipboard')
denny
denny am 13 Mai 2018
Great!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by