File Exchange

image thumbnail

Use Mac OS X XML Plists with MATLAB (Updated Version)

version (46.1 KB) by Yi Sui
A updated version of that by John Iversen


Updated 12 Sep 2012

View License

These utilities enable the conversion of data written by programs on Mac OS X for use in MATLAB (and vice versa).

Anyone wanting to share data with programs written for Mac OS X can use these utilities to convert the native OS X storage format (XML Property List) to structures. XML Property Lists are the preferred textual representation of property list dictionaries.

These utilities convert from XML property list to a matlab structure and back, and include m-files for loading and saving XML property lists from matlab.



Info on OS X Property Lists:


Cite As

Yi Sui (2020). Use Mac OS X XML Plists with MATLAB (Updated Version) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

>> S = loadXMLPlist('test.plist');
Undefined function or variable 'fid'.

Error in XMLPlistToStruct2 (line 240)

Error in loadXMLPlist (line 16)
[S KT]= XMLPlistToStruct2(text);


I like this function. It's quite useful indeed.

I have a problem however when I try compiling it. The compiler tells me that it does not accept cells. I can rewrite a more restricted version of the program without cells but there is still a compilation problem because there is a line in the code where the input xml (an mxArray) is indexed

tag = xml( (ibra(itag)+1):(iket(itag)-1) );

I get the message: Subscripting into an mxArray is not supported.

What can I do to fix the problem?



Great utility.

However, I get an error when trying to import a plist where the Root is an Array, and each item in the array is a Dict with three Numbers (x, y, z coordinates).

Error received:
Attempted to access arraylv(0); index must be a positive integer or logical.

Error in XMLPlistToStruct2 (line 112)
if arraylv(dictLevel) ==0

Error in loadXMLPlist (line 16)
[S KT]= XMLPlistToStruct2(text);

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Use Mac OS X XML Plists with MATLAB