File Exchange

image thumbnail


version (9.3 KB) by Primoz Cermelj
INI file reading and writing.


Updated 20 Jun 2009

View License

Utility to create/read/write entries into/from ascii ini file (strings, scalars and numeric matrices). Multiple keys can be read/written AT ONCE.
See inifile.m for additional information.

Cite As

Primoz Cermelj (2020). INIFILE (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (16)

Mr stone

One suggestion: Add a model to read an entire section

chen gang

it's useful for me

Tyler Cumby

I noticed a minor bug in the 'readall' option where in the keys return value, the last subsection is repeated for subsequent empty subsection names. My fix was to add
if ~isempty(subsecStr)
subsecStr = '';

in readallkeys(filename) under the if statement 'if status == 1' where new section names are incorporated.

Tyler Cumby


totally awesome!

One suggestion: Add an option to preserve the case of keys. That way it would be easy to create a broader range of Matlab structures dynamically.

Really great. Perfect to make and read easily config files.


Useful code

Great work,
it is really useful,
Thanks for your professional efforts...


Very usefull code.

Andrei Ninu

Jonathan Archer

The code could use a little tidying up. It could be more readable if limited to 75 columns.

Prakash Hanagud


Benton Lau

Very useful. No problem in Matlab v6.5.

Elmer Tom

Useful... Using it in MATLAB 5.2 with no problems so far...


License update

license update

Fix: When in read mode and a certain key is found but the value is empty, the default value will be used instead.


Update ('readall' option added)


Bug removed

Minor changes

Comment lines are now detected

Numeric matrices can be read/written; a bug related to read operation and default value has been removed

new version - conversion to/from integer and double is now supported

minor update and bug fixes


The proper file uploaded

Complete rewrite - a new concept - multiple keys can now be read, written, or deleted ALL AT ONCE which makes this function much faster.

Update; no additional functions needed anymore


Screenshot added

Screenshot added


Update - a major refinement and 'deletekey' option added.

Update; free code (M-file)

Update; (m-file instead of p-file)

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