Add new line in .ini file

조회 수: 7(최근 30일)
Deepa Maheshvare
Deepa Maheshvare 2021년 12월 19일
편집: Walter Roberson 2021년 12월 19일
I'm trying to set the properties of a class by loading the contents of the initialization file in a class method.
Source for INI class (https://www.mathworks.com/matlabcentral/fileexchange/55766-ini).
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 = struct( ...
'test1', false, ...
'test2', false, ...
'test3', false)
>>> settings.test_graph
ans =
'struct(...'
I would like to know how to add new line in .ini files.
I tried to add `...` which is how I add multiple lines in .m files. But this doesn't work i.e the struct is not read correctly from the .ini file; it is read as a string.
  댓글 수: 6
Deepa Maheshvare
Deepa Maheshvare 2021년 12월 19일
편집: Walter Roberson 2021년 12월 19일
I'm sorry, I forgot to add the reference.
Please find the INI class link here

댓글을 달려면 로그인하십시오.

답변(0개)

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by