View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

5.0 | 2 ratings Rate this file 2 Downloads (last 30 days) File Size: 4.82 KB File ID: #34076 Version: 1.1
image thumbnail




04 Dec 2011 (Updated )

Generates paste-able ASCII representations of MATLAB variables

| Watch this File

File Information

This function emulates the R version of dput(). It writes ASCII representations of variables that can be easily pasted back into MATLAB and evaluated to recreate the variables. This is especially useful for quickly posting short reproducible examples on sites like Stack Overflow, without having to upload any separate data files as attachments, and while overcoming the shortcomings of the "save -ascii" approach.

One particularly useful highlight is that dput can flexibly handle generic recursion into structure and cell arrays. It will work through these objects, repeatedly calling itself, to eventually capture their entire organization down to their basic elements.

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
21 Mar 2016 Alex

Alex (view profile)

26 Oct 2015 Carl Witthoft

wonderful tool

05 Dec 2011 John Colby

Thanks, Christie! I put the change on github, and it should be updated here by tomorrow.

Comment only
05 Dec 2011 christie harper

in your submission example you have:
mystruct = mystruct = struct('index', num....
it should be mystruct = struct('......

Comment only
05 Dec 2011 1.1

Added support for logical, integer, complex double data types. Added option to specify desired precision. Added xUnit tests.

Contact us