Clearing and reloading updates form initialization file in a class

2 ビュー (過去 30 日間)
Deepa Maheshvare
Deepa Maheshvare 2021 年 12 月 19 日
I'm trying to set the properties of a class by loading the contents of the initialization file (contains user-defined inputs) in a class method.
classdef setting
properties(Constant)
test_graph = settings_utils.data.test_graph;
end
methods(Static)
function data = load_data
I = INI('File','input.ini');
I.read();
data = I.get('UserData'); % struct
end
end
end
example.ini includes the following
[UserData]
test_graph = 'test1'
>> setting.test_graph
gives
'test1'
If the user changes the input in example.ini ('test1' is changed to 'test2'), clear settings followed by setting.test_graph
will return
'test2'.
But I am not sure how this works while creating executables. I have converted my main.m function into a executable using the Application compiler. I want the user to specify inputs (loaded from .ini file in `setting` class), .ini file is not converted into a binary file during compilation (i.e. I have excluded the example.ini file from `Files required for your application to run` tab in the Application compiler.) And the setting class (used in main) and other relevant functions are packaged into an executable.
In this case , I am not sure how the clases are cleared by the executable and how to load the new changes made in .ini in the settings class.
Could someone please give suggestions?

回答 (0 件)

カテゴリ

Help Center および File ExchangeConstruct and Work with Object Arrays についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by