Copy and paste text to and from system clipboard
the current contents of the clipboard. If
contents = clipboard('paste')
clipboard is unable
to retrieve the contents of the clipboard,
contents is empty
imports the contents of the clipboard using the Import Tool.
importedcontents = clipboard('pastespecial')
Copy and Paste Text
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 and Paste Data Using the Import Tool
Copy data into the clipboard and then import the clipboard data into MATLAB®.
Select the lines below, right-click, and then select Copy.
1,2,3 4,5,6 7,8,9
Import the clipboard data into MATLAB using the
clipboard function. The Import
A = clipboard('pastespecial')
In the Import Wizard, click Next and then
Finish to import the contents of the clipboard
data — Data to copy
numeric array | character vector | string scalar
Data to copy, specified as a numeric array, character vector, or string scalar.
contents — Contents of clipboard
Contents of the clipboard, returned as a character vector.
importedcontents — Contents of clipboard imported from Import Tool
Contents of the clipboard imported from the Import Tool, returned as a structure array.
Introduced before R2006a
mat2str | Import Tool