Skip to content

mlxwrite

io · scripts/io/mlxwrite.m

: mlxwrite(filename, content)
: mlxwrite(filename, content, name, value, …)

Create a MATLAB Live Script(.mlx) from code and text cells.

An .mlx file is an Open Packaging Conventions(OPC) ZIP archive. This writer emits a minimal package MATLAB R2026a can open: [Content_Types].xml, _rels/.rels, matlab/document.xml, and metadata/ core properties.

content may be:

  • A cell array. Each element is a character vector / string scalar(text), or a scalar struct with field Type ("code" or "text") and body in Content, Code, or Text. Text cells may set Style to "title", "heading", or "text".
  • A scalar struct with field Cells (as returned by mlxread).
  • A single character vector or string scalar(one text cell).

Name-value arguments:

"SectionType" (default "text")

Type used when a cell is a bare character / string ("code" or "text").

"Title"

When non-empty, prepend a "title" paragraph.

"MATLABRelease" (default "R2026a")

Written to metadata/mwcoreProperties.xml.

"MATLABVersion" (default empty)

Written to metadata/mwcorePropertiesExtension.xml when set.

Behaviour note: MATLAB R2026a does not ship a public mlxwrite M-file or builtin. This Nexus API is a clean-room writer for the documented OPC .mlx layout(same cell structs as mlxread).