Convert all cell array to string

  • Follow


Hi i have a cell array with some strings and some numbers all mixed up.

How can i convert each of my cells to a string?

Cheers
0
Reply Fraser 4/15/2010 4:29:22 PM

"Fraser Dickson" <fraser.dickson@gmail.com> wrote in message <hq7et2$c1m$1@fred.mathworks.com>...
> Hi i have a cell array with some strings and some numbers all mixed up.
> 
> How can i convert each of my cells to a string?
> 
> Cheers

this FEX submission might be helpful

http://www.mathworks.com/matlabcentral/fileexchange/23840

us
0
Reply us 4/15/2010 5:18:05 PM


Dear Fraser!

> Hi i have a cell array with some strings and some numbers all mixed up.
> How can i convert each of my cells to a string?

C = {'a', 9, 'b', 10};
numIndex = cellfun('isclass', C, 'double');
tmpStr = sprintf('%g;', C{numIndex});
C(numIndex) = dataread('string', tmpStr, '%s', 'delimiter', ';');

Jan
0
Reply Jan 4/15/2010 6:57:04 PM

2 Replies
901 Views

(page loaded in 0.092 seconds)

Similiar Articles:













7/21/2012 8:08:01 PM


Reply: