2 %> @ingroup globals setupgroup
3 %> @brief writes MATLAB M file irootlab_setup.m
5 %> Writes several global variables into a MATLAB source file called <code>irootlab_setup.m</code>. This file can be later executed to restore
6 %> the setup conditions.
8 %> The variables written are the graphics globals, database globals, and verbose globals.
10 %> For a list of written variables to setup, please check the source code of
this file.
16 s0 = [sprintf('
verbose_assert();\ndb_assert();\nfig_assert();\npath_assert();\nmore_assert();\n')]; %
#ok<NBRAK>
21 which = {
'SCALE',
'COLORS',
'MARKERS',
'MARKERSIZES',
'FONT',
'FONTSIZE',
'LINESTYLES', ...
22 'VERBOSE.minlevel',
'VERBOSE.flag_file', ...
23 'DB.host',
'DB.name',
'DB.user',
'DB.pass', ...
24 'PATH.data_load',
'PATH.data_save',
'PATH.data_spectra',
'PATH.doc', ...
25 'MORE.pd_maxpeaks',
'MORE.pd_mindist_units',
'MORE.pd_minheight',
'MORE.pd_minaltitude', ...
26 'MORE.ssp_stabilitythreshold',
'MORE.ssp_minhits_perc',
'MORE.ssp_nf4gradesmode',
'MORE.bc_halfheight', ...
27 'MORE.flag_postpr_grag',
'COLORS_STACKEDHIST'};
30 for i = 1:numel(which)
31 fi = find(which{i} ==
'.');
33 whichglobals{end+1} = which{i}(1:fi-1); %#ok<*AGROW>
35 whichglobals{end+1} = which{i};
38 whichglobals = unique(whichglobals);
41 for i = 1:numel(whichglobals)
45 s1 = cat(2, s1, whichglobals{i});
47 s1 = cat(2, s1,
';', 10);
54 for i = 1:numel(which)
56 syma = eval(which{i});
58 irerror(sprintf(
'Problem trying to evaluate "%s": %s', which{i}, ME.message));
65 ss = [
'% V V', 10,
'% vvvO8 8Ovvv', 10,
'% IRootLab setup generated at ', datestr(now()),
'.', 10,
'% Please note that this file may be automatically re-generated by IRootLab.', 10,
'% Do not add comments, as these will not be kept.', 10, s0, 10, s1, s2];
67 h = fopen(
'irootlab_setup.m',
'w');
70 irverbose(
'Wrote file "irootlab_setup.m"', 1);
73 % Converts colors to 0-255 range
75 global COLORS COLORS_STACKEDHIST;
78 COLORS_STACKEDHIST =
convert_(COLORS_STACKEDHIST);
83 % Converts to 0-1 if COLORS has values above 0-1
86 C = cellfun(@(x) round(x*255), C, 'UniformOutput', 0);
function irverbose(in s, in level)
function verbose_assert()
function convert_to_str(in c)
function convert_colors()