Any alternative to readstruct to accelerate large XML file importation?
16 views (last 30 days)
Show older comments
I often import large mzXML files in MATLAB using the mzxmlread function of the Bioinformatics Toolbox, that is based on the readstruct function. Note that mzXML files are basically XML files.
My files typically each take 1 to 3 GB of disk space, and the importation consequently takes time (3-10 minutes).
Are there any tricks or any alternatives to the readstruct function, that could use parallel calculation for example, in order to import one single mzXML files faster?
Regards.
3 Comments
Oskar Munk Kronik
on 20 Jan 2023
Hi Phenan08,
I'm having the same challenges. Did your trails work?
Thanks in advance
Answers (1)
Pratyush
on 23 Oct 2023
Hi phenan08,
I understand that you work with large mzXML files. These files take a long time to import in MATLAB, and you want some workaround that is less time-consuming to work with these files.
Here are a few suggestions that may help:
- Memory Mapping: Instead of loading the entire mzXML file into memory, you can consider using memory mapping techniques. MATLAB provides functions like 'memmapfile' that allow you to access the data in the file without loading it entirely. This can help reduce memory usage and improve performance. Refer to the following documentation for details on 'memmapfile': Create memory map to a file - MATLAB memmapfile - MathWorks India
- Read Subset of Data: If you only need to work with a subset of the data in the mzXML file, you can consider reading only the required portions. This can be achieved by modifying the readstruct function or using lower-level XML parsing functions in MATLAB, such as xmlread, to extract only the necessary data.Refer to the following documentation for details on 'xmlread': Read XML document and return Document Object Model node - MATLAB xmlread - MathWorks India
- External Libraries: MATLAB provides the ability to call external libraries using the mex interface. You can explore libraries specifically designed for efficient XML parsing, such as "libxml2" or "Xerces-C++", and create a custom MEX function to import the mzXML files faster.
0 Comments
See Also
Categories
Find more on Live Scripts and Functions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!