RunMat
GitHub

histogram — Create histogram objects with bin-edge semantics, normalization controls, and MATLAB histogram workflows.

histogram is the object-style histogram builtin in RunMat. Unlike legacy hist, it uses bin-edge semantics, supports normalization workflows through the histogram evaluation path, and returns a histogram handle that works with get and set as part of the plotting object model.

How histogram works in RunMat

  • histogram(data) creates a histogram object handle.
  • When you pass explicit bins through histogram-style arguments, they are treated as bin edges rather than bin centers.
  • Normalization modes such as count, probability, percentage, density-style variants, and cumulative forms are part of the evaluation path.
  • The returned histogram handle exposes properties like bin edges, counts, and normalization through get and accepts updates through set where supported.
  • This is the preferred histogram API for new code; use hist only when you intentionally want legacy center-based MATLAB semantics.

Examples

Create a histogram object from data

data = randn(1, 1000);
h = histogram(data);

Expected output:

% h is a histogram object handle

Use explicit bin edges and inspect the handle

data = randn(1, 500);
edges = -3:0.25:3;
h = histogram(data, 'BinEdges', edges);
get(h, 'BinEdges');

Apply normalization through histogram semantics

data = randn(1, 500);
h = histogram(data, 'Normalization', 'probability');
get(h, 'Normalization')

Expected output:

ans =
    'probability'

These functions work well alongside histogram. Each page has runnable examples you can try in the browser.

hist, bar, get, set

Open-source implementation

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

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.

Getting started · Benchmarks · Pricing

Try RunMat — free, no sign-up

Start running MATLAB code immediately in your browser.