File Exchange

image thumbnail

strjoin

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

0 Downloads

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 (2019). strjoin (https://www.mathworks.com/matlabcentral/fileexchange/39143-strjoin), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Jan

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