Skip to main content

The package parses the xml output of publish in MATLAB,.

Project description

This package is used to parse the xml output of MATLAB publish, and this way facilitate deriving more advanced documentation that contain MATLAB code with matching output and figures.

Usage

MATLAB processing

Write the code that you want to create output from as a MATLAB publish document. The package will parse the code, and separate the different cells. The package will separate documentation, executed code, console output and figures.

In MATLAB process the created file (in this case example.m) using publish:

publish('example.m',...
        'format', 'xml',...
        'imageFormat', 'epsc',...
        'outputDir', 'gen/',...
        'catchError', false);  % Fail on thrown exception

This will produce the file gen/example.xml

Python Processing

Usage:

import matlab_publish_parser as mpp

mf = matlab_publish_parser.parse(Path('example.xml'))

print(mf.filename)  # The name of the processed file
print(mf.output_dir)  # Directory for generated files
for c in mf.cells:
  print(c.title)  # Title of cell
  print(c.code)  # Executed code in cell
  print(c.output)  # Console output from cell
  ...

Explore the object to figure out what has been extracted.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matlab_publish_parser-2025.0.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matlab_publish_parser-2025.0.0-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file matlab_publish_parser-2025.0.0.tar.gz.

File metadata

File hashes

Hashes for matlab_publish_parser-2025.0.0.tar.gz
Algorithm Hash digest
SHA256 77d2a84e59ba9e46d2be9812a48db4fc093c1557ad9cb36c00c45c05170cbc2b
MD5 54526fad82e1f20a520b71d9657c505c
BLAKE2b-256 62f2d49de4f69379dd99bcbbd91c1758729616b96cc3cde371aba638d8d8fd63

See more details on using hashes here.

File details

Details for the file matlab_publish_parser-2025.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for matlab_publish_parser-2025.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3da97a5368a3a438a10f3cd666fa8bfe794b28c78107bc60879b4425011d5793
MD5 1e8bdf10c2b032562309e1f248633d3b
BLAKE2b-256 0181b8b6953bef3a65c312b2fd83662582948e0808fc304f2432da85fa596070

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page