RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.2, Nov 26, 2026 ·

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.

/
See all docs
Builtin Reference
    • sendmail
    • urldecode
    • urlencode
    • weboptions
    • webread
    • websave
    • webwrite

weboptions — Create options for HTTP requests.

weboptions creates a host options structure for webread, websave, and webwrite.

Syntax

options = weboptions()
options = weboptions(optionsStruct)
options = weboptions(name, value, ...)
options = weboptions(optionsStruct, name, value, ...)

Inputs

optionsStruct
Type
Any
Required
Yes
Description
Existing options struct to copy and override (RunMat extension).
name
Type
StringScalar
Required
Variadic
Description
Case-insensitive option field name.
value
Type
Any
Required
Variadic
Description
Option field value.
NameTypeRequiredDefaultDescription
optionsStructAnyYes—Existing options struct to copy and override (RunMat extension).
nameStringScalarVariadic—Case-insensitive option field name.
valueAnyVariadic—Option field value.

Returns

options
Type
Any
Description
Host HTTP options struct for webread, webwrite, and websave.
NameTypeDescription
optionsAnyHost HTTP options struct for webread, webwrite, and websave.

Errors

RunMat:weboptions:InvalidArgument
When
Argument shape/type does not match supported weboptions forms.
Message
weboptions: invalid argument
RunMat:weboptions:InvalidOptionName
When
Name-value option key is missing or not text scalar.
Message
weboptions: invalid option name
RunMat:weboptions:MissingOptionValue
When
A name-value key is not followed by a value.
Message
weboptions: missing option value
IdentifierWhenMessage
RunMat:weboptions:InvalidArgumentArgument shape/type does not match supported weboptions forms.weboptions: invalid argument
RunMat:weboptions:InvalidOptionNameName-value option key is missing or not text scalar.weboptions: invalid option name
RunMat:weboptions:MissingOptionValueA name-value key is not followed by a value.weboptions: missing option value
RunMat:weboptions:InvalidOptionValueAn option value fails type or domain validation.weboptions: invalid option value
RunMat:weboptions:UnknownOptionName-value key does not map to a supported option.weboptions: unknown option
RunMat:weboptions:InvalidCredentialsPassword is provided without a username.weboptions: invalid credentials
RunMat:weboptions:FlowNested flow fails while gathering input values.weboptions: flow failure
RunMat:weboptions:TooManyOutputsMore than one output is requested.weboptions: too many output arguments

Forms and fields

weboptions() returns defaults; case-insensitive name-value pairs override them. In RunMat mode, an existing options struct may be copied and overridden. The input struct is not mutated.

The implemented fields are ContentType, Timeout, HeaderFields, UserAgent, Username, Password, KeyName, KeyValue, RequestMethod, MediaType, and the RunMat-only QueryParameters. Unknown names raise an error. CharacterEncoding, ContentReader, ArrayFormat, and CertificateFilename are not accepted by the current constructor or consumed by these HTTP operations.

The default timeout is 5 seconds. Timeout accepts a positive numeric scalar up to 2147.483647 seconds or Inf; accepted native integer values are converted to bounded timeout seconds. KeyValue accepts a text, numeric, or logical scalar and retains exact native integer storage. When paired with nonempty KeyName, webread and webwrite emit one HTTP header with exact integer decimal text.

ContentType accepts auto, json, text, or binary (with documented text/binary aliases). RequestMethod accepts auto, get, post, put, patch, or delete; the consuming operation decides whether a method is supported. HeaderFields accepts a struct or two-column cell array.

Empty username and password leave basic authentication disabled. A nonempty password without a username is rejected. HeaderFields and QueryParameters can be cleared with an empty struct or an empty two-column cell array.

Execution and compatibility

Options construction performs no network request. webread, webwrite, or websave later use the active host HTTP service to make a request; a stored option value does not own a session or grant transport capability.

Options are host metadata. Automatically resident values gather through their owning provider after pure option admission. Explicit gpuArray input requires the named RunMat extension before provider access. The resulting structure is host-resident and terminates fusion.

Copying an input struct and using QueryParameters are separate RunMat extensions. Both are rejected in MATLAB-compatible mode; ordinary name-value construction remains available.

This page's portable examples check the constructed fields without contacting a live endpoint. The webread and webwrite pages contain executable loopback examples that exercise these options against deterministic HTTP fixtures.

Examples

Set a request timeout

opts = weboptions('Timeout', 10);

Expected output:

opts.Timeout = 10

Store basic authentication credentials

opts = weboptions('Username', 'ada', 'Password', 'lovelace');

Configure JSON request and response

opts = weboptions('ContentType', 'json', 'MediaType', 'application/json');

Apply custom headers from a structure

headers = struct('Accept', 'application/json');
opts = weboptions('HeaderFields', headers);

Copy options and override with query parameters

base = weboptions('ContentType', 'json');
opts = weboptions(base, 'Timeout', 15, 'QueryParameters', struct('verbose', true));

Using weboptions with coding agents

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

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

FAQ

Which option names are supported in RunMat?⌄

The constructor accepts ContentType, Timeout, HeaderFields, UserAgent, Username, Password, KeyName, KeyValue, RequestMethod, MediaType, and the RunMat-only QueryParameters. Unknown fields, including CharacterEncoding, ContentReader, ArrayFormat, and CertificateFilename, are rejected.

What does RequestMethod='auto' mean?⌄

webread treats auto as GET and webwrite treats it as POST. The consuming operation validates any explicit method it supports.

How are empty usernames or passwords handled?⌄

Empty values leave authentication disabled. A nonempty password without a username raises an error.

Can I pass query parameters through the options struct?⌄

Yes in RunMat mode: use a struct or two-column cell array for QueryParameters. MATLAB-compatible mode rejects this named extension.

Do I need to manage GPU residency for options?⌄

Automatically resident values gather through their owning provider. Explicit gpuArray values require RunMat mode; the returned struct is host-resident.

Does weboptions mutate the input struct?⌄

No. The RunMat copy-and-override form leaves the input struct unchanged.

How can I clear headers or query parameters?⌄

Use an empty struct or empty two-column cell array for the corresponding field.

Related Io functions

Http

sendmail · urldecode · urlencode · webread · websave · webwrite

Net

accept · read · readline · tcpclient · tcpserver · write

Repl Fs

addpath · cd · copyfile · delete · dir · exist · fileattrib · fileparts · filesep · fullfile · genpath · getenv · getpref · isenv · isfile · isfolder · ispref · ls · matlabroot · memmapfile · memmapfile.subsasgn · memmapfile.subsref · mkdir · movefile · open · opentoline · path · pathsep · pcode · pwd · readstruct · rehash · restoredefaultpath · rmdir · rmpath · run · savepath · setenv · setpref · system · tempdir · tempname · uigetdir · uigetfile · uiputfile · unsetenv · userpath · what · winqueryreg · xmlread · xmlwrite

Tabular

arrayDatastore · csvread · csvwrite · detectImportOptions · dlmread · dlmwrite · fileDatastore · getvaropts · parquetDatastore · parquetinfo · parquetread · readcell · readmatrix · readtable · readtimetable · setvaropts · setvartype · spreadsheetImportOptions · writecell · writematrix · writetable · writetimetable · xlsread · xlswrite

Audio

audioinfo · audioread

Io

clc · diary · disp · display · format · input

Data

commit · data.copy · data.create · data.delete · data.exists · data.export · data.import · data.inspect · data.list · data.move · data.open · DataArray.chunk_shape · DataArray.codec · DataArray.dtype · DataArray.fill · DataArray.name · DataArray.rank · DataArray.read · DataArray.resize · DataArray.shape · DataArray.write · Dataset.array · Dataset.arrays · Dataset.attrs · Dataset.begin · Dataset.get_attr · Dataset.has_array · Dataset.id · Dataset.path · Dataset.refresh · Dataset.set_attr · Dataset.set_attrs · Dataset.snapshot · Dataset.version · DataTransaction.abort · DataTransaction.commit · DataTransaction.create_array · DataTransaction.delete_array · DataTransaction.fill · DataTransaction.id · DataTransaction.resize · DataTransaction.set_attr · DataTransaction.set_attrs · DataTransaction.status · DataTransaction.write

Filetext

fclose · feof · fgetl · fgets · fileread · filewrite · fopen · fprintf · fread · frewind · fwrite · readlines · writelines

Archive

gunzip · gzip · unzip

Hdf5

h5disp · h5info · h5read · h5write · h5writeatt · hdf5info · hdf5read · hdf5write

Import

importdata · textscan

Json

jsondecode · jsonencode

Mat

load · matfile · matlab.io.MatFile.subsasgn · matlab.io.MatFile.subsref · save

Source you can read

Every RunMat function's source is public. Read exactly how weboptions is executed, line by line, in Rust.

  • View the source for weboptions in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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
  • Inputs
  • Returns
  • Errors
  • Forms and fields
  • Execution and compatibility
  • Examples
  • Set a request timeout
  • Store basic authentication credentials
  • Configure JSON request and response
  • Apply custom headers from a structure
  • Copy options and override with query parameters
  • Using weboptions with coding agents
  • FAQ
  • Related Io functions
  • Http
  • Net
  • Repl Fs
  • Tabular
  • Audio
  • Io
  • Data
  • Filetext
  • Archive
  • Hdf5
  • Import
  • Json
  • Mat
  • Source you can read
  • About RunMat