Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCDDS-core
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SPC
SCDDS
SCDDS-core
Commits
06e2af5f
Commit
06e2af5f
authored
4 years ago
by
Federico Felici
Browse files
Options
Downloads
Patches
Plain Diff
generalize configuration setter
parent
28b1d4ff
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
code/functions/SCDconf_setCODEconf.m
+4
-12
4 additions, 12 deletions
code/functions/SCDconf_setCODEconf.m
code/functions/SCDconf_setConf.m
+33
-0
33 additions, 0 deletions
code/functions/SCDconf_setConf.m
code/functions/SCDconf_setSIMconf.m
+1
-13
1 addition, 13 deletions
code/functions/SCDconf_setSIMconf.m
with
38 additions
and
25 deletions
code/functions/SCDconf_setCODEconf.m
+
4
−
12
View file @
06e2af5f
...
...
@@ -4,21 +4,13 @@
% otherwise it takes the first argument as the name of the
% configuration settings to be copied into configurationSettings
function
[]
=
SCDconf_setCODEconf
(
varargin
)
function
[]
=
SCDconf_setCODEconf
(
varargin
)
if
nargin
==
0
codeconfname
=
'configurationSettings
CODE
icc
'
;
conf
=
'
CODE'
;
else
codeconfname
=
varargin
{
1
};
conf
=
varargin
{
1
};
end
fprintf
(
'Setting configurationSettings = %s at configurations.sldd level ...\n'
,
codeconfname
);
d
=
Simulink
.
data
.
dictionary
.
open
(
'configurations.sldd'
);
dd
=
getSection
(
d
,
'Configurations'
);
activeconf
=
dd
.
getEntry
(
'configurationSettings'
);
codeconf
=
dd
.
getEntry
(
codeconfname
);
configurationSettings
=
codeconf
.
getValue
;
configurationSettings
.
Name
=
'configurationSettings'
;
activeconf
.
deleteEntry
;
dd
.
addEntry
(
'configurationSettings'
,
configurationSettings
);
SCDconf_setConf
(
conf
)
answ
=
input
(
'Perform git tag operations [(Y)es/(N)o]?'
,
's'
);
switch
upper
(
answ
)
...
...
This diff is collapsed.
Click to expand it.
code/functions/SCDconf_setConf.m
0 → 100644
+
33
−
0
View file @
06e2af5f
function
SCDconf_setConf
(
conf
)
% set configuration setting
% SCDconf_setConf(conf)
% conf: 'SIM', 'CODE' or use custom conf name
switch
lower
(
conf
)
case
'sim'
confName
=
'configurationSettingsSIM'
;
case
'code'
confName
=
'configurationSettingsCODEicc'
;
otherwise
confName
=
conf
;
% custom input
end
fname
=
'configurations.sldd'
;
% dd file name
disp
(
'Setting configurationSettings = %s in configurations.sldd ...'
,
confName
);
dd
=
Simulink
.
data
.
dictionary
.
open
(
fname
);
confSection
=
getSection
(
dd
,
'Configurations'
);
assert
(
confSection
.
exist
(
confName
),
'%s does not exist in %s'
,
confName
,
fname
);
simconf
=
confSection
.
getEntry
(
confName
);
configurationSettings
=
simconf
.
getValue
;
configurationSettings
.
Name
=
'configurationSettings'
;
% create or set new configurationSettings entry
if
confSection
.
exist
(
'configurationSettings'
)
activeconf
=
confSection
.
getEntry
(
'configurationSettings'
);
activeconf
.
setValue
(
configurationSettings
);
else
confSection
.
addEntry
(
'configurationSettings'
,
configurationSettings
)
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
code/functions/SCDconf_setSIMconf.m
+
1
−
13
View file @
06e2af5f
% Sets the simulation configuration settings on all the models
function
[]
=
SCDconf_setSIMconf
()
disp
(
'Setting configurationSettings = configurationSettingsSIM in configurations.sldd ...'
);
d
=
Simulink
.
data
.
dictionary
.
open
(
'configurations.sldd'
);
dd
=
getSection
(
d
,
'Configurations'
);
simconf
=
dd
.
getEntry
(
'configurationSettingsSIM'
);
configurationSettings
=
simconf
.
getValue
;
configurationSettings
.
Name
=
'configurationSettings'
;
if
dd
.
exist
(
'configurationSettings'
)
activeconf
=
dd
.
getEntry
(
'configurationSettings'
);
activeconf
.
setValue
(
configurationSettings
);
else
dd
.
addEntry
(
'configurationSettings'
,
configurationSettings
)
end
SCDconf_setConf
(
'SIM'
);
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment