Code covered by the BSD License  

Highlights from
uneval

Be the first to rate this file! 4 Downloads (last 30 days) File Size: 4.52 KB File ID: #19953

uneval

by David Holl

 

16 May 2008 (Updated 15 Nov 2011)

Uneval performs the inverse operation of eval('expression').

| Watch this File

File Information
Description

This function converts a MATLAB variable into a text string, which when evaluated, produces the original variable having identical:
data types (single, double, int8, ...)
structures
cell arrays
multi-dimensional arrays
nested struct's of cell arrays of structs of ...

For floating point values, enough significant digits are printed to preserve machine precision.

Contrived example usage:
settings = load('some_data.mat');
string = uneval('settings2', settings)
eval(string);
disp(isequalwithequalnans(settings, settings2));

This function probably does not work with handles to nested functions, figure handles, or java & OOP objects...

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
08 Jul 2011 Patrick Houweling

This function requires cell_ind2sub. Where can I get it?

15 Nov 2011 David Holl

Sorry for the omission. I just submitted an update with the missing cell_ind2sub function.

Please login to add a comment or rating.
Updates
15 Nov 2011

The original package was missing a misnamed subroutine called CELL_IND2SUB.

15 Nov 2011

Included missing cell_ind2sub subroutine.

Tag Activity for this File
Tag Applied By Date/Time
eval data structures strings David Holl 22 Oct 2008 10:02:03
eval David Holl 15 Nov 2011 11:08:05
strings David Holl 15 Nov 2011 11:08:06
data structures David Holl 15 Nov 2011 11:08:06
data export David Holl 15 Nov 2011 11:08:06
data import David Holl 15 Nov 2011 11:08:06

Contact us at files@mathworks.com