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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
X | Any | Yes | — | Input data array. |
Returns
| Name | Type | Description |
|---|---|---|
tbl | Any | Frequency table. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:tabulate:InvalidArgument | Inputs, flags, dimensions, or options are malformed. | descriptive statistics: invalid argument |
RunMat:tabulate:Internal | Internal 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.
Related Stats functions
Summary
binocdf · boxplot · cdf · cdfplot · chi2cdf · corr · corrcoef · corrcov · cov · cov2corr · dummyvar · ecdf · filloutliers · fitdist · geomean · grpstats · harmmean · icdf · isoutlier · kstest · kurtosis · lsline · mad · mode · nanmax · normalize · normcdf · norminv · normpdf · onehotdecode · onehotencode · pdf · prctile · quantile · refline · rmse · skewness · tcdf · tiedrank · tinv · tpdf · ttest2 · wblinv
Ml
bayesopt · classify · confusionmat · crossvalind · cvpartition · fitclinear · fitctree · fitlm · kmeans · knnsearch · lasso · lassoglm · linkage · lscov · mnrfit · optimizableVariable · pdist · pdist2 · perfcurve · predict · regress · ridge · squareform · test · training · tsne
Random
binornd · bootstrp · datasample · dividerand · exprnd · gamrnd · lhsdesign · mvnrnd · normrnd · random · randsample · rng · trnd · unidrnd · unifrnd · wblrnd
Hist
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how tabulate is executed, line by line, in Rust.
- View the source for tabulate 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.