tags:

views:

405

answers:

2

I want to use YAML to communicate some data across multiple languages. (Think of it as "language-independent serialization".) One of these languages is MATLAB, but I can't seem to find a YAML library for that language. I've checked for "matlab yaml" and "matlab yaml parse" on Google and there don't seem to be any relevant results. A search of "yaml" on MATLAB Central also left me empty-handed.

Is there really no existing YAML library for MATLAB? I'm fine with writing one, but I would like to avoid duplicating work. (Perhaps something to share?)

+1  A: 

Call existing Java YAML import libraries from Matlab. This should be pretty strightforward. Java-Matlab interoperability is pretty good, see matlab help.

Mikhail
That's a great idea -- didn't even think of it. Will the data types in Java be coverted into the appropriate types in Matlab? Never messed with the Java stuff much...
Benjamin Oakes
Numeric types are converted implicitly, strings have to be converted explicitly with either cell(myJavaArray) for arrays or char(myJavaString), see Matlab help, it is pretty good on this topic.
Mikhail
Take a look at SnakeYAML (http://code.google.com/p/snakeyaml/wiki/readme)
Has anyone actually followed through and done this?
AndyL
+1  A: 

@AndyL For sankeyaml, add it to your javapath, then import('org.yaml.snakeyaml.Yaml'), and it works like the docs; the resulting LinkedHashMap is accessed more or less like a matlab struct.

natto

related questions