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
bf20a117
Commit
bf20a117
authored
4 years ago
by
Cristian Galperti
Browse files
Options
Downloads
Patches
Plain Diff
disable log function improved
parent
8cf22f3c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/disablesignalslog.m
+20
-7
20 additions, 7 deletions
test/disablesignalslog.m
with
20 additions
and
7 deletions
test/disablesignalslog.m
+
20
−
7
View file @
bf20a117
% DEPRECATED JUST AFTER WRITTEN, USE DEL IN THE SIMULATION DATA INSPECTOR
% TO DELETE LOGGED SIGNALS
% This function parses automatically
% This function parses automatically
% all signals of the given modelname
% all signals of the given modelname
% (comprising all submodels)
% (comprising all submodels)
% and asks whether to disable log for
% and asks whether to disable log for
% signals (which are marked for logging)
% signals (which are marked for logging)
%
% the function asks before removing any logging
% unless the additional parameter couple 'force', 1
% is given in varargin
function
disablesignalslog
(
topmodelname
,
varargin
)
P
=
inputParser
;
P
.
addParameter
(
'force'
,
0
);
P
.
parse
(
varargin
{:});
force
=
P
.
Result
.
force
;
function
disablesignalslog
(
topmodelname
)
disp
(
'Getting mdlrefs info ...'
);
disp
(
'Getting mdlrefs info ...'
);
[
models
,
blocks
]
=
find_mdlrefs
(
topmodelname
);
[
models
,
blocks
]
=
find_mdlrefs
(
topmodelname
);
for
mod
=
1
:
numel
(
models
)
for
mod
=
1
:
numel
(
models
)
fprintf
([
'Analyzing model '
char
(
models
{
mod
})
'\n'
]);
fprintf
([
'Analyzing model '
char
(
models
{
mod
})
'\n'
]);
disablesignalslogsinglemodel
(
models
{
mod
});
disablesignalslogsinglemodel
(
models
{
mod
}
,
force
);
end
end
end
end
function
disablesignalslogsinglemodel
(
modelname
)
function
disablesignalslogsinglemodel
(
modelname
,
force
)
load_system
(
modelname
);
load_system
(
modelname
);
mdlsignals
=
find_system
(
modelname
,
'FindAll'
,
'on'
,
'LookUnderMasks'
,
'all'
,
'FollowLinks'
,
'on'
,
'type'
,
'line'
,
'SegmentType'
,
'trunk'
);
mdlsignals
=
find_system
(
modelname
,
'FindAll'
,
'on'
,
'LookUnderMasks'
,
'all'
,
'FollowLinks'
,
'on'
,
'type'
,
'line'
,
'SegmentType'
,
'trunk'
);
ph
=
get_param
(
mdlsignals
,
'SrcPortHandle'
);
ph
=
get_param
(
mdlsignals
,
'SrcPortHandle'
);
for
i
=
1
:
length
(
ph
)
for
i
=
1
:
length
(
ph
)
try
try
if
strcmp
(
get_param
(
ph
{
i
},
'datalogging'
),
'on'
)
if
strcmp
(
get_param
(
ph
{
i
},
'datalogging'
),
'on'
)
answer
=
input
([
'MDL: '
modelname
' SIG: '
get_param
(
ph
{
i
},
'Name'
)
' log is '
get_param
(
ph
{
i
},
'datalogging'
)
', turn off? [Y/N]:'
],
's'
);
if
~
force
if
strcmp
(
answer
,
'Y'
)
answer
=
input
([
'MDL: '
modelname
' SIG: '
get_param
(
ph
{
i
},
'Name'
)
' log is '
get_param
(
ph
{
i
},
'datalogging'
)
', turn off? [Y/N]:'
],
's'
);
else
fprintf
([
'MDL: '
modelname
' SIG: '
get_param
(
ph
{
i
},
'Name'
)
' disabling logging.\n'
]);
answer
=
'Y'
;
end
if
strcmp
(
upper
(
answer
),
'Y'
)
set_param
(
ph
{
i
},
'datalogging'
,
'off'
);
set_param
(
ph
{
i
},
'datalogging'
,
'off'
);
end
end
end
end
...
...
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