You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
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...
Cite As
David Holl (2026). uneval(var_name, value, return_cell_array) (https://www.mathworks.com/matlabcentral/fileexchange/19953-uneval-var_name-value-return_cell_array), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.6.0.0 (10.7 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.6.0.0 | Included workaround for large int64 and uint64 values that MATLAB may accidentally truncate via intermediate casts to double precision. |
||
| 1.5.0.0 | Replaced cellstr2string in favor of "the_string = sprintf('%s\n', the_string{:});" |
||
| 1.4.0.0 | Fixed missing "end". |
||
| 1.3.0.0 | Included missing cell_ind2sub subroutine. |
||
| 1.2.0.0 | The original package was missing a misnamed subroutine called CELL_IND2SUB. |
||
| 1.0.0.0 |
