WDX (.wdx)

Background & Context

    • 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.
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • 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:

This converts the WDX string back to an expression: