How to modify parameters in a compile GUI by loading a file?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello all,
I have a GUI with many parameters that are user defined. I compiled the GUI in an exe to use it in standalone. As there are many parameters to be set by the user I wanted to offer the possibility to save/load a "setting file" that will contain a set of parameters. I managed to do it using a .m file and it works properly when testing it in matlab. However in compile version of the GUI the load function doesn't work as it cannot interpret the .m file (that cannot be added in the dependancies when building the exe as the file may be saved by user during the use of the program and then load back). Is there a way to load a file to control the values of parameters or I am stuck with user modification when using a compile GUI?
Thanks
0 comentarios
Respuestas (2)
Salaheddin Hosseinzadeh
el 3 de Sept. de 2014
Dear Nicolas,
First of all it's such a nice idea to get the settings from the file. Sounds really cool to me.
I kind of had the same issue, but what I did was I was put a setting button on GUI that opens a question dialog and everything is initialized before, and you can change settings, but I had about 15 20 settings.
What I suggest you to do is to create a text file, and instead of load use fopen to open the file, and lets say each parameter is going to be in one line, with a name and corresponding value.
Then use fgetl to read 1 line at a time, extract the parameter name and value, and then you're done, you can close the file.
doc fopen
doc fgetl
doc fclose
Hope this helps.
Good Luck!
0 comentarios
Iain
el 3 de Sept. de 2014
Don't use an "m" file for settings. You need to use, for example, a fixed format text file, or a fixed format excel file, or a binary file.
"xlsread" will read excel files. - This will let users edit settings files away from your GUI.
Binary files can be specific to your GUI. - This will prevent users editing & understanding settings files.
Text files can be read and edited in notepad.
0 comentarios
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!