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
    • bi2de
    • bin2dec
    • de2bi
    • dec2bin
    • dec2hex
    • hex2dec

dec2hex — Convert decimal integers to hexadecimal character rows in MATLAB and RunMat.

dec2hex(D) converts each element of D to one uppercase hexadecimal character row. dec2hex(D, minDigits) pads rows to at least minDigits characters. Numeric arrays are processed in column-major element order and produce one output row per element.

Syntax

dec2hex(D)

How dec2hex works

  • D may be numeric, integer, logical, character, or gpuArray numeric data.
  • Double inputs must be finite integer values.
  • Nonnegative values are padded with 0 characters.
  • Negative values are represented using the smallest signed two's-complement storage width that can contain the value, with additional padding using F characters.
  • Signed integer inputs preserve their source integer storage width for negative two's-complement output.
  • minDigits must be a finite nonnegative integer scalar.
  • Outputs larger than RunMat's character-output safety limit are rejected before formatting.
  • Complex, non-finite, fractional, and unsupported input values raise an error.

Examples

Convert a scalar decimal value

s = dec2hex(1023)

Expected output:

s = '3FF'

Pad to a minimum width

s = dec2hex(1023, 6)

Expected output:

s = '0003FF'

Convert multiple values to padded rows

s = dec2hex([1023 122 14])

Expected output:

s = ['3FF'; '07A'; '00E']

Format a negative value as two's complement

s = dec2hex(-16)

Expected output:

s = 'F0'

Using dec2hex with coding agents

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

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

FAQ

Are fractional inputs accepted?⌄

No. RunMat requires finite integer values for dec2hex.

Are hexadecimal letters uppercase?⌄

Yes. RunMat emits uppercase A through F characters.

Related Comms functions

Conversion

bi2de · bin2dec · de2bi · dec2bin · hex2dec

Modulation

pskmod · qammod

Open-source implementation

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

  • View the source for dec2hex 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
  • How dec2hex works
  • Examples
  • Convert a scalar decimal value
  • Pad to a minimum width
  • Convert multiple values to padded rows
  • Format a negative value as two's complement
  • Using dec2hex with coding agents
  • FAQ
  • Related Comms functions
  • Conversion
  • Modulation
  • Open-source implementation
  • About RunMat