MATLAB config file that loads variables at runtime

7 Ansichten (letzte 30 Tage)
Vincenzo
Vincenzo am 4 Jun. 2024
Kommentiert: Vincenzo am 5 Jun. 2024
I would like to have a configuration file that acts similarly to a .config file that you would find in a C# program. Meaning I would like the variables in the config file to load into the application at runtime. I'm using the Application Compiler app to build the executable. I have tried having a text file with my config variables that is read at the beginning of the program, but it seems that these are only read when the application is compiled. I would like to compile/build the app only once, and have it read in the variables each time it runs. Is there a way for this to work within MATLAB?

Akzeptierte Antwort

Voss
Voss am 4 Jun. 2024
Use the app's startupFcn.
  3 Kommentare
Voss
Voss am 5 Jun. 2024
I was thinking more like what you described in the question: "having a text file with my config variables that is read at the beginning of the program"
I wasn't thinking anything about changing the configuration or the user having to enter anything.
Vincenzo
Vincenzo am 5 Jun. 2024
I see now. I had focused on the "Input arguments" component to the startupFcn in the documentation. Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by