phd-simscape-micro-station/matlab/src/initializeLoggingConfiguration.m

34 lines
829 B
Matlab

function [] = initializeLoggingConfiguration(args)
arguments
args.log char {mustBeMember(args.log,{'none', 'all', 'forces'})} = 'none'
args.Ts (1,1) double {mustBeNumeric, mustBePositive} = 1e-3
end
conf_log = struct();
switch args.log
case 'none'
conf_log.type = 0;
case 'all'
conf_log.type = 1;
case 'forces'
conf_log.type = 2;
end
conf_log.Ts = args.Ts;
if exist('./mat', 'dir')
if exist('./mat/conf_log.mat', 'file')
save('mat/conf_log.mat', 'conf_log', '-append');
else
save('mat/conf_log.mat', 'conf_log');
end
elseif exist('./matlab', 'dir')
if exist('./matlab/mat/conf_log.mat', 'file')
save('matlab/mat/conf_log.mat', 'conf_log', '-append');
else
save('matlab/mat/conf_log.mat', 'conf_log');
end
end