strjoin — Join text across each input row using an explicit delimiter.
strjoin joins text across each row of the input using the delimiter you provide. RunMat's current implementation accepts string scalars, string arrays, and character arrays, converts character-array rows into strings, and returns a column string array containing one joined result per input row.
How strjoin works
strjoin(str, delim)requires an explicit delimiter argument in the current implementation.- String arrays are joined row-wise across columns, producing one output string per row.
- Character arrays are first interpreted row-by-row and then joined the same way.
- The return type is always a string array.
- Empty inputs with zero rows or zero columns currently return an empty
0x0string array. - Cell arrays of character vectors are not currently accepted by this implementation.
How RunMat runs strjoin on the GPU
strjoin performs no provider dispatch. GPU-resident text inputs are gathered before the join is computed on the CPU.
GPU memory and residency
No. strjoin gathers text to host memory and returns a host-side string array.
Examples
Join a row vector of strings with commas
labels = ["alpha" "beta" "gamma"];
out = strjoin(labels, ", ")Expected output:
out = "alpha, beta, gamma"Join each row of a string matrix independently
names = ["Ada" "Lovelace"; "Grace" "Hopper"];
out = strjoin(names, " ")Expected output:
out = 2×1 string
"Ada Lovelace"
"Grace Hopper"Join rows of a character array
chars = ['ab'; 'cd'];
out = strjoin(chars, "-")Expected output:
out = 2×1 string
"a-b"
"c-d"FAQ
Is the delimiter optional?
Not in the current RunMat implementation. Pass strjoin(str, delim) explicitly.
Does strjoin join by row or by column?
It joins across columns within each row, returning one output string per input row.
Can I pass a cell array of character vectors?
Not currently. This implementation accepts string scalars, string arrays, and character arrays.
Related Strings functions
Transform
erase · eraseBetween · extractBetween · join · lower · pad · replace · split · strcat · strip · strrep · strsplit · strtrim · upper
Core
char · compose · num2str · sprintf · str2double · strcmp · strcmpi · string · string.empty · strings · strlength · strncmp
Search
contains · endsWith · startsWith · strfind
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how strjoin works, line by line, in Rust.
- View strjoin.rs on GitHub
- Learn how the runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.
- Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
- Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
- A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.