Skip to content
Snippets Groups Projects
Commit bf20a117 authored by Cristian Galperti's avatar Cristian Galperti
Browse files

disable log function improved

parent 8cf22f3c
No related branches found
No related tags found
No related merge requests found
% 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment