How to set ini value with INI Config
Afficher commentaires plus anciens
Hi,
I am using INI Config to read from and write to a custom .ini-file. The reading works perfectly, I use the GetValues-Function for that.
However, I cannot get the SetValues-Function to work. I do not get an Error but the value in my .ini-file does not change either.
[~] = ini.SetValues('Category','SettingA','Teststring');
Nothing happens. Does anybody know what I am doing wrong here?
Thanks in advance!
4 commentaires
Geoff Hayes
le 22 Nov 2018
Michael - please clarify what you mean by nothing happens. Are you trying to update an existing key with a new value? Does your section 'Category' exist? Or is it not saving the update to file (I suspect you have to call ni.WriteFile('example2.ini') to save your changes.
Also, what is the return value from your above call? For example,
[status] = ini.SetValues('Category','SettingA','Teststring');
what is status? If the "set" works, then this value will be 1. Else, if it fails, it will be a 0.
Please note that I was able to call **SetValues* and update an existing key within the section...
Michael Critchfield
le 22 Nov 2018
Geoff Hayes
le 22 Nov 2018
MIchael - could you paste the code that you have written that creates the ini file (with default settings) and then the code that updates the file (which "corrupts" it).
Michael Critchfield
le 22 Nov 2018
Modifié(e) : Michael Critchfield
le 23 Nov 2018
Réponses (0)
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!