readstruct/writestruct changes boolean value true to "true"
Show older comments
Hello,
I am working on a MATLAB app at the moment. Some user controllable settings need to be preserved over restarting the app. During runtime these settings (statuses of buttons, text areas and checkboxes) are saved in a struct. On exiting the app, the struct is written to the hard drive of the PC using the function writestruct.
On startup, the app is loading the created XML file using readstruct. However, the values of the checkboxes (either logical true or false) are not read/saved correctly. Logical values are converted to strings.
Code example for reading/writing the struct to xml:
Write:
file = uiputfile('\Path\to\File\*.xml','Save');
writestruct(app.Settings,file,"FileType","xml");
Read:
file = uigetfile('\Path\to\File\*.xml');
app.Settings = readstruct(file,"FileType","xml");
While debugging, I tried to restore the settings during runtime with the generated struct, which worked as intended.
Thank you for your help!
I attached the generated XML file as an M file because I'm not allowed to upload files with the XML extension…
1 Comment
Accepted Answer
More Answers (0)
Categories
Find more on Standard File Formats in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!