Clearing and reloading updates form initialization file in a class
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Construct and Work with Object Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!