RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • blkdiag
    • cat
    • circshift
    • diag
    • flip
    • fliplr
    • flipud
    • horzcat
    • ipermute
    • kron
    • permute
    • repelem
    • repmat
    • reshape
    • rot90
    • squeeze
    • toeplitz
    • tril
    • triu
    • vertcat

vertcat — Concatenate inputs vertically along the first dimension with MATLAB semicolon semantics.

vertcat(A1, A2, ...) stacks inputs top-to-bottom along dimension 1, equivalent to MATLAB semicolon syntax [A1; A2; ...] with compatible shape rules.

Syntax

B = vertcat()
B = vertcat(A1, An...)

Inputs

NameTypeRequiredDefaultDescription
A1AnyYes—First input array.
AnAnyVariadic—Additional input arrays.

Returns

NameTypeDescription
BAnyVertically concatenated result (dimension 1).

Errors

IdentifierWhenMessage
RunMat:vertcat:InvalidInputInputs are malformed or incompatible for vertical concatenation.vertcat: invalid input arguments
RunMat:vertcat:TypeMismatchInput classes cannot be concatenated together.vertcat: incompatible input classes for concatenation

How vertcat works

  • Hard-codes dim = 1. All inputs must agree on every dimension except the first.
  • Accepts numeric, logical, complex, character, string, and cell arrays with the same class-dominance rules as cat(...,1). Real integer mixtures preserve the leftmost participating integer class with saturating conversion.
  • Scalars are treated as 1×1, enabling concise row-building such as vertcat(1, 2, 3).
  • Empty inputs participate naturally. If any shared dimension is zero, the result is empty with the expected shape.
  • Compatible host and resident numeric inputs use the owning provider when possible; otherwise RunMat gathers exact values, concatenates on the host, and restores the result when the owner can preserve its class.

Does RunMat run vertcat on the GPU?

vertcat delegates to cat(dim = 1, …). When the active acceleration provider implements the cat hook, concatenation happens entirely on the GPU, keeping gpuArray inputs resident and avoiding costly round-trips. Providers that lack this hook trigger a transparent fallback: RunMat gathers the operands to the host, concatenates them with MATLAB semantics, and uploads the result back to the originating device so downstream code still sees a gpuArray. This mirrors MATLAB's explicit GPU workflows while keeping RunMat's auto-offload planner informed.

Examples

Stacking matrices by adding rows

A = [1 2; 3 4];
B = [5 6; 7 8];
C = vertcat(A, B)

Expected output:

C =
     1     2
     3     4
     5     6
     7     8

Building a column vector from scalars

col = vertcat(1, 2, 3, 4)

Expected output:

col =
     1
     2
     3
     4

Combining character arrays into taller text blocks

top = ['RunMat'];
bottom = ['Rocks!'];
banner = vertcat(top, bottom)

Joining string arrays into multi-row tables

header = ["Name" "Score"];
rows = ["Alice" "98"; "Bob" "92"];
table = vertcat(header, rows)

Preserving logical masks when stacking

mask1 = logical([1 0 1]);
mask2 = logical([0 1 0]);
stacked = vertcat(mask1, mask2)

Extending cell arrays downwards

row1 = {1, "low"};
row2 = {2, "high"};
grid = vertcat(row1, row2)

Keeping gpuArray inputs resident on the device

G1 = gpuArray(rand(128, 256));
G2 = gpuArray(rand(64, 256));
stacked = vertcat(G1, G2)

Working with empty rows without surprises

empty = zeros(0, 3);
combo = vertcat(empty, empty)

Stacking complex matrices preserves imaginary parts

z1 = complex([1 2], [3 4]);
z2 = complex([5 6], [7 8]);
joined = vertcat(z1, z2)

Using vertcat with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how vertcat changes the result.

Run a small vertcat example, explain the result, then change one input and compare the output.

Related Array functions

Shape

blkdiag · cat · circshift · diag · flip · fliplr · flipud · horzcat · ipermute · kron · permute · repelem · repmat · reshape · rot90 · squeeze · toeplitz · tril · triu

Grouping

accumarray · combinations · discretize · findgroups · groupcounts · grp2idx · splitapply

Sorting Sets

argsort · intersect · ismember · ismembertol · issorted · issortedrows · setdiff · setxor · sort · sortrows · union · unique

Creation

colon · createArray · empty · eye · false · full · inf · linspace · logspace · magic · meshgrid · nan · nchoosek · ndgrid · nonzeros · ones · peaks · perms · rand · randi · randn · randperm · range · sparse · spdiags · speye · spones · sprand · true · zeros

Indexing

find · ind2sub · sub2ind

Introspection

iscolumn · isempty · ismatrix · isrow · isscalar · isvector · length · ndims · numel · size

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how vertcat is executed, line by line, in Rust.

  • View the source for vertcat 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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How vertcat works
  • Does RunMat run vertcat on the GPU?
  • Examples
  • Stacking matrices by adding rows
  • Building a column vector from scalars
  • Combining character arrays into taller text blocks
  • Joining string arrays into multi-row tables
  • Preserving logical masks when stacking
  • Extending cell arrays downwards
  • Keeping gpuArray inputs resident on the device
  • Working with empty rows without surprises
  • Stacking complex matrices preserves imaginary parts
  • Using vertcat with coding agents
  • Related Array functions
  • Shape
  • Grouping
  • Sorting Sets
  • Creation
  • Indexing
  • Introspection
  • Open-source implementation
  • About RunMat