No BSD License  

Highlights from
cellmatrix2str & str2cellmatrix

2.6

2.6 | 5 ratings Rate this file 5 Downloads (last 30 days) File Size: 689 Bytes File ID: #14952

cellmatrix2str & str2cellmatrix

by Aman Siddiqi

 

10 May 2007 (Updated 11 May 2007)

Parses sentances into cells of individual words, and the reverse

| Watch this File

File Information
Description

cellmatrix2str({'test ' 'me'})
Yields 'test me' as a character string.
It combines all the cells into 1 string

str2cellmatrix('This is a test')
yields a 1x4 cell matrix with each word in a seperate cell. This parses a string into individual cell blocks.

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
11 May 2007 C. S.

Trivial.

17 Jul 2007 Ricardo Hernandez-Perez

Very useful! Thanks

25 Mar 2008 Durga Shrestha

cellmatrix2str({'test ' 'me'}) gives me 'testme' but not 'test me' as mentioned by author. Author uses "strcat" function and trailing spaces in strings are ignored.

Use the concatenation syntax array to preserve trailing spaces.

array= [array number{character}];

PS: Please use variable name that is consistent with its purpose. For example variable name 'number' is confusing here. You could use name 'cellString' so that the user knows that the input is array of cell strings.

10 Apr 2009 Neslihan Fidan  
15 Oct 2009 Jan Simon

The jobs can be performed much faster and more reliable with Matlab functions: sprintf('%s', CellStr{:}) and strread(Str, '%s', 'delimiter', ' ');
The source is not clean: Unneeded semicolons, square brackets, no error handling, really lean documentation.
At least: It works! => 2 stars although I'd recommend not to use this.

15 Oct 2009 Jan Simon  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
matrices Aman Siddiqi 22 Oct 2008 09:12:28
conversion Cristina McIntire 23 Feb 2009 15:35:22
string Cristina McIntire 23 Feb 2009 15:35:22
cell Cristina McIntire 23 Feb 2009 15:35:22
convert Cristina McIntire 23 Feb 2009 15:35:22
cell2str Cristina McIntire 23 Feb 2009 15:35:22
str2cell Cristina McIntire 23 Feb 2009 15:35:22

Contact us at files@mathworks.com