File Exchange

image thumbnail

strjoin

version 1.0 (1.36 KB) by

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

1 Download

Updated

View License

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.

Comments and Ratings (1)

Jan Simon

Jan Simon (view profile)

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{:});

MATLAB Release
MATLAB 7.8 (R2009a)
Tags Add Tags

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

» Watch video