MATLAB Answers


How to make an application that uses data files as resource

I'm working on an application to batch process CT images. When pressing "run" the application looks for new batches and when done adds these new batches to the list of processed batches. The way it does this is by reading an excel-file with all processed batches to see if there are new batches in a folder, and afterwards the excel-file is overwritten with an extended list.
The users also want the option to set default input and output paths. To save the default paths I use another excel-file in which the current default paths are stored. This file is overwritten when the user changes the default paths. Another excel-file has parameters in it that are used as input in generating statistic reports from the output. Also these parameters can be changed by the user, so the file is overwritten when they are changed.
This works fine on my own PC when unpackaged (Using "Run" in the App Designer), but when I package the application, the app is unable to overwrite the files. It can't find the files.
So my question is, how do you make an application in which the user can set default values or paths so that next time the program is opened the new values or paths or used? Is it a good idea to use external files for this? If so, how would I do it better? How do I need to define the paths to the files in my code?
For the users it would actually be easy to use excel-files for the settings so they can easily make changes when necessary.
All files that where needed were added to "Shared resources and helper files" when packaging.
Any help is highly appreciated!


Sign in to comment.

1 Answer

Answer by Sean de Wolski
on 17 May 2018
 Accepted Answer

doc setpref
doc getpref

  1 Comment

Thank you, Sean! I made it work with setpref and getpref. Apparently I missed all documentation about setting preferences completely. Very useful!

Sign in to comment.