Using a config file to specify model set-up (.json or .env??)
Mostrar comentarios más antiguos
Hi all,
I am brand new to MATLAB and previously coded in Python. Previously, when using environmental models (such as a crop growth model) in Python, I would use a configuration file, which in this case was a .json file, to specify the model parameters (e.g. plant photosynthesis rate) that could then be read by the model to set it up. In this way I only changed the .json file for customising model runs for different locations and years. Now that I have changed jobs and I am working in MATLAB I am wondering the most appropriate way to do something similar. If I want to have a configuration file that contains all the information needed to customise a model run (e.g. the filepath for the save location, name for the save file, years to run the model for, method to use), what kind of file and structure for the model should I use?
I have been reading about .env files, which could be useful to help me set environmental variables which would be visible to multiple files within the same model, but then I wasn't sure if that is good practice. If I use a .json file and I want the information in it to be visible for all files in my model I believe I may have to use MATLAB preferences to do this - again I wasn't sure if this was good practice. These are my options as I understand them, but I would be very grateful for the advice of the community on this matter as I begin my MATLAB journey! Thankyou.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre JSON Format en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!