Code covered by the BSD License  

Highlights from

5.0 | 10 ratings Rate this file 43 Downloads (last 30 days) File Size: 4.74 KB File ID: #28708 Version: 1.2



Jiro Doke (view profile)


13 Sep 2010 (Updated )

Copy and paste image data to and from system clipboard.

| Watch this File

File Information

IMCLIPBOARD behaves very much like MATLAB's "CLIPBOARD" function, but it works on image data. You can paste image data from the clipboard to a MATLAB array, and copy MATLAB image data to the clipboard.

From HELP:

IMCLIPBOARD('copy', IMDATA) sets the clipboard content to the image represented by IMDATA. IMDATA must be MxN grayscale (double, uint8, uint16), MxN black and white (logical), MxNx3 true color (double, uint8, uint16)

IMCLIPBOARD('copy', X, MAP) sets the clipboard content to the image data represented by indexed image X with colormap MAP. X must be MxN matrix (double, uint8, uint16) and MAP must be Px3 (double).

IMDATA = IMCLIPBOARD('paste') returns the current image content in the clipboard as a true color image (MxNx3 uint8).

[X, MAP] = IMCLIPBOARD('paste') returns the current image content in the clipboard as an indexed color image.

IMCLIPBOARD('paste') displays the image in a new figure window.

[...] = IMCLIPBOARD('paste', FILENAME) saves the image as FILENAME. FILENAME must be a name to one of the following image formats: JPG, GIF, BMP, PNG, TIF.

Note: IMCLIPBOARD requires Java on all platforms.


Clipboardimage and Clipboardpaste inspired this file.

This file inspired Export Fig.

MATLAB release MATLAB 7.11 (R2010b)
Other requirements Requires Java
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
19 Nov 2015 Dan K

Dan K (view profile)

This no longer works in R2015b. A fix has been posted at:

20 May 2015 Ilya Belevich  
10 Feb 2014 Norman Koren  
22 Oct 2013 Alexander

Perfect tool for automatically moving images to the clipboard so that they can be copied into Word etc.

22 Nov 2012 Daeyong Kim

It's great.

20 Mar 2012 Will Reeves  
29 Nov 2011 owr

owr (view profile)

28 Nov 2011 K E

K E (view profile)

Matlab's default Figure > Copy option is vastly improved witht he following,
imclipboard('copy', export_fig('r', 190, 'format', 'png'));
This is useful for copying a figure into Outlook or Word.
[credit for this solution to by Oliver Woodford not me!]

30 Sep 2010 Eric

Eric (view profile)

Whoops - the problem was with how I was calling it. It works great from within a GUI as well. I'm using it to copy an image of my GUI to the clipboard. This function gives a nicer image than print(gcbf, '-dmeta').

Comment only
30 Sep 2010 Eric

Eric (view profile)

30 Sep 2010 Eric

Eric (view profile)

It does what it says. However, when I call it from within a GUI, the next callback that is activated (by changing a number in a text box or clicking a button), does not execute. As an example, I get the following warning for my GUI called ProductViewer. I can generate a similar error by activating any control in the GUI.

Warning: Error occurred while evaluating listener callback.
> In graphics\private\clo at 83
In cla at 29
In newplot>ObserveAxesNextPlot at 125
In newplot at 74
In imagesc at 21
In ProductViewer>PlotFrame at 629
In ProductViewer>edit_row_min_Callback at 514
In gui_mainfcn at 96
In ProductViewer at 87
In @(hObject,eventdata)ProductViewer('edit_row_min_Callback',hObject,eventdata,guidata(hObject))

15 Sep 2010 1.1

Updated copyright in Java code.

27 Sep 2010 1.2

License update

Contact us