Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

easy-to-edit configuration file for a matlab function

Tags:

matlab

Like ini file, I basically want to have an easy-to-edit configuration file that can be used to read and distribute the info into matlab objects. I know people would recommend xml but the format is not easy for user to edit. Can anyone have any other way?

like image 753
Tae-Sung Shin Avatar asked May 09 '12 21:05

Tae-Sung Shin


2 Answers

I use YAML files all the time for config files with MATLAB applications. I've found them to be easily human-readable and editable, version-controllable, and very straightforward to use.

They have the advantage (over a MATLAB script) of also being widely readable by other languages (Perl, Python, Ruby, Java etc) if the config files also need to be used by other parts of a wider application.

There is a YAML file reader for MATLAB (a wrapper around the free Apache-licensed SnakeYaml Java library) that is publicly available. I've also written my own which I'd be happy to share (it's based on the package I linked to, with slightly less functionality, but quite a bit easier to understand the code and a bit more robust).

like image 114
Sam Roberts Avatar answered Sep 24 '22 10:09

Sam Roberts


Why not use ini files - for simple to edit and read, they can't be beat? They've got problems getting complex, but as long as you're aware of it.

file exchange is your friend: http://www.mathworks.com/matlabcentral/fileexchange/24992-ini-config

You could also use Java Properties files. (I couldn't find anything in file exchange. You'd have to write the interface yourself.)

like image 23
Marc Avatar answered Sep 25 '22 10:09

Marc