File Exchange

image thumbnail

Straightforward COPY and PASTE functions

version 1.13.0.0 (5.68 KB) by Yvan Lengwiler
Allows very simple manual exchange with other applications through the clipboard.

3.8K Downloads

Updated 21 Jan 2015

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Matlab's CLIPBOARD command allows the user to import and export data to and from other applications. But this command is limited to strings, or requires some mouse work when importing numerical arrays with the 'pastespecial' option.
This submission consists of two functions that make moving simple data from and to Matlab extremely easy. They are used as follows:
1) From Matlab to other application: In Matlab, say copy(x). Then in the other program (eg Excel, Word, Mathematica etc), import with the local Paste function. Depending on what kind of class x is, different material is pushed to the clipboard. For instance, if x is a numerical array, the receiving function will also see numerical data, not a string (as it would when using clipboard('copy',...)).
2) From another application to Matlab: In the other application, use the copy function to place content into the clipboard. Then, in Matlab, say x = paste; Depending of the structure of the data in the clipboard, the program makes x either a numerical array, a cell array, or a string.
See the help provided in the two functions for some examples. The two functions are limited to numerical arrays, cell arrays, and strings. They do not support structs or special classes.
Please comment if you like it or find it useful.

Cite As

Yvan Lengwiler (2021). Straightforward COPY and PASTE functions (https://www.mathworks.com/matlabcentral/fileexchange/28016-straightforward-copy-and-paste-functions), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: num2clip: copy numerical arrays to clipboard

Inspired: vjmedina/MCTB

Community Treasure Hunt

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

Start Hunting!