WDX (.wdx)

Background

    • Wolfram Language WDX data format.
    • Used by the Wolfram Language for storing and exchanging expressions and data.
    • WDX is an acronym derived from Wolfram Data Exchange.
    • Binary format.
    • Stores arbitrary Wolfram Language expressions in a serialized, platform-independent form.
    • Developed in 2007 by Wolfram Research.

Import & Export

  • Import["file.wdx"] reads in a Wolfram Language package, evaluating each expression in it and returning the last one.
  • Export["file.wdx",expr] exports a single expression to a Wolfram Language source file.
  • Import["file.wdx",elem] imports the specified element from a Wolfram Language source file.
  • Import["file.wdx",{elem,suba,subb,}] imports a subelement.
  • Import["file.wdx",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","WDX"] or Import["file",{"WDX",elem,}].
  • Import["file.wdx"] is equivalent to Get["file.wdx"].
  • Export["file.wdx",expr,elem] creates a Wolfram Language source file by treating expr as specifying element elem.
  • Export["file.wdx",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
  • Export["file.wdx",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.wdx",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • Put[expr1,expr2,,"file.wdx"] can be used to export multiple expressions.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the WDX format.

Import Elements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation element:
  • "Expression"reads and evaluates the expression stored in the file
  • Import by default uses the "Expression" element for Wolfram Language WDX files.
  • Metainformation element:
  • "Version"file format version number

Examples

Basic Examples  (1)

This converts an arbitrary expression to a string in WDX format:

In[1]:=
Click for copyable input
Out[1]=

This converts the WDX string back to an expression:

In[2]:=
Click for copyable input
Out[2]=
Introduced in 2007
(6.0)