File Exchange

image thumbnail


version 1.1 (1.67 KB) by

Convert 2-D cell array into evaluable string



View License

B = CELL2STR(C) returns a B such that C = EVAL(B).

This is the same as NUM2STR, except it works on cell arrays that contain strings, numeric arrays and other cell arrays. C must be a 2D cell array. B will be a string that can be evaluated. to return a cell array identical (up to numerical accuracy) to C.

Optional input arguments:

B = CELL2STR(C,N) uses N digits of precision for numeric arrays. N defaults to 15.

B = CELL2STR(C,'class') and B = CELL2STR(C,N,'class') also include the class string for the numeric arrays.

Comments and Ratings (2)

Cris Luengo

Cris Luengo (view profile)

Now also works for cell arrays containing other cell arrays.

Julien Gaugaz

Works great for flat cell arrays, but doesn't work for cell-arrays containing other cell-arrays, e.g.:
>> utils.cell2str({{1}})
??? Error using ==> cell2str at 64
Illegal value in cell array.



Extended to work with cell arrays.

MATLAB Release
MATLAB 7.9 (R2009b)

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

» Watch video