parula — Return the parula colormap as an m-by-3 RGB array.

parula returns MATLAB's default colormap as an m-by-3 numeric RGB array with values in [0, 1]. With no argument, it uses the current colormap length, or 256 when no figure colormap length is active.

Syntax

c = parula()
c = parula(m)

Inputs

NameTypeRequiredDefaultDescription
mNumericScalarNocurrent colormap length or 256Number of colors as a nonnegative integer.

Returns

NameTypeDescription
cNumericArraym-by-3 RGB colormap array with values in [0, 1].

Errors

IdentifierWhenMessage
RunMat:colormapArray:InvalidArgumentThe requested colormap length or RGB colormap array is invalid.colormap array: invalid argument

How parula works

  • parula() returns an m-by-3 RGB matrix.
  • parula(m) returns exactly m rows, where m must be a nonnegative integer.
  • The result can be passed directly to colormap, including command forms such as colormap(parula).

Examples

Apply the default parula colormap

surf(peaks(40));
colormap(parula);
colorbar;

Request a specific number of colors

c = parula(64);

Using parula with coding agents

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

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

FAQ

What size is parula()?

It returns the active colormap length when one exists, otherwise 256 rows by 3 columns.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how parula 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.