File Exchange

image thumbnail


version (1.36 KB) by Joao Henriques
Joins cell array into a single string, with delimiter. Small, vectorized and fast.


Updated 27 Nov 2012

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.

Cite As

Joao Henriques (2020). strjoin (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)


Have you seen: ? 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 Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags