No License

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

» Watch video

Highlights from

2.8 | 6 ratings Rate this file 6 Downloads (last 30 days) File Size: 780 Bytes File ID: #23229 Version: 1.0



Daniel Claxton (view profile)


CELL2STR converts a cell array of strings into a character array.

| Watch this File

File Information

CELL2STR converts a cell array of strings into a character array. The resulting character array is possible by padding the strings in each row with spaces.

str = {'this' 'is' 'a' 'test' 'of' 'cell' '2' 'str'};

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (10)
09 Nov 2012 Venkatesh

14 Sep 2012 Lili

Lili (view profile)

07 Sep 2011 Alex

Alex (view profile)

05 Jan 2010 Jan Simon

Jan Simon (view profile)

PS: I've downloaded this file accidently 4 times, because it appears in the browser instead of the usual dialog for downloading and saving to disk.

Comment only
05 Jan 2010 Jan Simon

Jan Simon (view profile)

I'd expect a function called Cell2Str to reply a string as [1 x N] CHAR vector and not a CHAR matrix.
The name of the built-in function CHAR is very equivalent to the other methods to convert values to a specific type: DOUBLE, SINGLE, LOGICAL, (U)INT8, (U)INT16, (U)INT32, (U)INT64.
Cell2Str has some potential for improvements: CELLFUN(@length) is much slower than CELLFUN('prodofdims'). The method fails for {M x N} cell strings or if a cell element contains a CHAR array. The input is not checked. The padding can be created faster in a FOR loop.
But if you start to optimize it, please replace the complete processing by a call of the fast and more powerful command CHAR.
The documentation of the code is well, a help section exists, but is lean. The program works. Therefore I give 2 stars inspite of the limited use.
I admit, that the number of downloads is impressive. But why is this function downloaded?

30 Nov 2009 Markus Huber

I didn't know CHAR, so if found it by searching for a conversion from cell to strings! File-Exchange is sometimes better than the Matlab Documentation... Maybe you should note CHAR in the description!

Comment only
24 Sep 2009 Marco Cococcioni

Although Jos and us are right, I think this function deserves to stay here, because its name is more intuitive that the built-in 'char', which is not expected to do the conversion. The high number of downloads of this function seems to confirm my opinion. Best regards, MC

Comment only
10 Mar 2009 us

us (view profile)

this is exactly what CHAR does - in one simple shot...

10 Mar 2009 Jos (10584)

Jos (10584) (view profile)

Nice programming exercise for duplicating the built-in CHAR function. Please remove.

09 Mar 2009 Kenneth Eaton

How is this different from the following?...

>> str = {'this' 'is' 'a' 'test' 'of' 'cell' '2' 'str'};
>> char(str)

ans =


Comment only

Contact us