Code covered by the BSD License  

Highlights from
strjoin

Be the first to rate this file! 14 Downloads (last 30 days) File Size: 1.36 KB File ID: #39143

strjoin

by

 

Joins cell array into a single string, with delimiter. Small, vectorized and fast.

| Watch this File

File Information
Description

This simple function takes a cell array of strings and joins them, using a delimiter.

It doesn't use any FORs or slow operations so it's useful for performance-critical code.

Required Products MATLAB
MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
28 Nov 2012 Jan Simon

Have you seen: http://www.mathworks.com/matlabcentral/fileexchange/26077-cstr2string ? This C-Mex pre-allocates the output to gain more speed. But even in pure Matlab this might be faster than expanding the input cell string:
delimiter = strrep(delimiter, '\', '\\');
s = sprintf(['%s', delimiter], c{:});

Contact us