tabulate — Create a frequency table.

tabulate(X) returns value, count, and percent columns. Numeric inputs return a numeric matrix; string-like inputs return a cell array.

Syntax

tbl = tabulate(X)

Inputs

NameTypeRequiredDefaultDescription
XAnyYesInput data array.

Returns

NameTypeDescription
tblAnyFrequency table.

Errors

IdentifierWhenMessage
RunMat:tabulate:InvalidArgumentInputs, flags, dimensions, or options are malformed.descriptive statistics: invalid argument
RunMat:tabulate:InternalInternal tensor conversion or allocation fails.descriptive statistics: internal error

How tabulate works

  • Positive integer numeric vectors include zero-count rows for missing integer levels between 1 and max(X).
  • Non-integer numeric values are grouped by exact numeric value and sorted ascending.
  • Numeric NaNs are omitted from the table and from percentage denominators.
  • Logical, string arrays, and cell arrays of scalar strings return a cell frequency table.
  • Percentages are relative to the number of non-missing input elements.

Example

Frequency table

tbl = tabulate([1 3 3])

Using tabulate with coding agents

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

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

FAQ

Why does tabulate([1 3 3]) include 2?

For positive integer numeric vectors, MATLAB includes missing integer levels with zero counts.

Open-source implementation

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

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.