clipboard - Copy and paste text to and from system clipboard - MATLAB (original) (raw)
Main Content
Copy and paste text to and from system clipboard
Syntax
Description
clipboard('copy',[data](#mw%5Ff89668a0-f957-4feb-ad2d-dd847ef678b7))
copies the specified data to the clipboard.
[contents](#mw%5F86b7bfe4-6ebf-497a-a85a-efc522f49133) = clipboard('paste')
returns the current contents of the clipboard. If clipboard
is unable to retrieve the contents of the clipboard, contents
is empty (''
).
[importedcontents](#mw%5F86bcd0f2-1de3-4314-b537-54d865192bdb) = clipboard('pastespecial')
imports the contents of the clipboard using the Import Tool.
Examples
Copy a line of text into the clipboard and then paste it into an array.
clipboard('copy', 'This is the text that I want to copy'); contents = clipboard('paste')
contents = 'This is the text that I want to copy'
Copy data into the clipboard and then import the clipboard data into MATLABĀ®.
Select the lines below, right-click, and then select .
Import the clipboard data into MATLAB using the clipboard
function. The Import Tool opens.
A = clipboard('pastespecial')
In the Import Tool, click Next and thenFinish to import the contents of the clipboard into A
.
Input Arguments
Data to copy, specified as a numeric array, character vector, or string scalar.
Output Arguments
Contents of the clipboard, returned as a character vector.
Contents of the clipboard imported from the Import Tool, returned as a structure array.
Version History
Introduced before R2006a