File Exchange

image thumbnail

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

version 1.0 (46.1 KB) by

A updated version of that by John Iversen

4 Downloads

Updated

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.

    XMLPlistToStruct
    structToXMLPlist

    loadXMLPlist
    saveXMLPlist

Info on OS X Property Lists: http://developer.apple.com/documentation/Cocoa/
Conceptual/PropertyLists/Concepts/XMLPListsConcept.html

John

Comments and Ratings (2)

Pierre Gravel

Bonjour,

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?

Pierre

Simon

Simon (view profile)

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
MATLAB 7.14 (R2012a)
Acknowledgements

Inspired by: Use Mac OS X XML Plists with MATLAB

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video