strjoin — Join text elements using delimiters with MATLAB-compatible strjoin row-wise behavior.
strjoin combines text elements using a delimiter and returns joined text outputs. It supports MATLAB-compatible row-wise joining forms across supported string and character container inputs.
Syntax
out = strjoin(text, delimiter)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
text | Any | Yes | — | Input text array. |
delimiter | Any | Yes | — | Delimiter inserted between row elements. |
Returns
| Name | Type | Description |
|---|---|---|
out | Any | Joined string array. |
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.
- Numeric arrays are not implicitly formatted as text. Convert them with
stringbefore joining when that conversion is intentional.
Does RunMat run strjoin on the GPU?
strjoin performs no provider dispatch. Unsupported provider-resident numeric values reject instead of being gathered and implicitly formatted.
GPU memory and residency
No. strjoin accepts host text and returns a host-side string array; provider-resident numeric values are not text inputs.
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"Using strjoin with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how strjoin changes the result.
Run a small strjoin example, explain the result, then change one input and compare the output.
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
append · deblank · erase · eraseBetween · erasePunctuation · eraseURLs · extractAfter · extractBefore · extractBetween · insertAfter · insertBefore · join · lower · pad · replace · replaceBetween · reverse · split · splitlines · strcat · strip · strjust · strrep · strsplit · strtrim · upper
Text Analytics
addDependencyDetails · addEntityDetails · addLemmaDetails · addPartOfSpeechDetails · addSentenceDetails · addTypeDetails · bagOfNgrams · bagOfWords · cosineSimilarity · doc2sequence · encode · extractFileText · extractHTMLText · fastTextWordEmbedding · findElement · getAttribute · htmlTree · ind2word · isVocabularyWord · normalizeWords · readWordEmbedding · removeLongWords · removeShortWords · removeStopWords · removeWords · stopWords · tokenDetails · tokenizedDocument · trainWordEmbedding · vaderSentimentScores · vec2word · word2ind · word2vec · wordEncoding · writeWordEmbedding
Core
blanks · char · compose · convertCharsToStrings · convertContainedStringsToChars · convertStringsToChars · genvarname · int2str · isletter · isspace · isStringScalar · isstrprop · mat2str · native2unicode · newline · num2str · sprintf · sscanf · str2double · str2num · strcmp · strcmpi · string · string.empty · strings · strlength · strncmp · strncmpi · strtok · unicode2native
Search
contains · endsWith · matches · startsWith · strfind
Pattern
digitsPattern · lettersPattern · pattern · regexpPattern · textBoundary · wildcardPattern
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how strjoin is executed, line by line, in Rust.
- View the source for strjoin in Rust on GitHub
- Learn how the RunMat 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 blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.