create_log

create_log(var_names, varargin)

CREATE_LOG Generate and log pipeline run information to an executable .m file

Usage:

[run_ID, fname] = create_log(var_names, ‘Name’, Value, …)

Inputs:

var_names : cell of char - names of caller-workspace variables to log – required

Name-Value Pairs:

‘run_ID’ : char - unique identifier for the run (default: ‘’ – autogenerate) ‘ID_len’ : integer - length of autogenerated unique identifier (default: 7) ‘fname’ : char - output log filename (default: ‘’ – autogenerate from prefix/ID/time) ‘run_prefix’ : char - prefix used when autogenerating fname (default: ‘runlog’) ‘file_path’ : char - directory to write the log file into (default: ‘’) ‘write_file’ : logical - whether to write the log to disk (default: true) ‘verbose’ : logical - whether to also echo the log to the command window (default: true)

Outputs:

run_ID : char - unique identifier for this run fname : char - filename of the written log

Example

struct1.f1 = ‘asdf’; struct1.f2 = 23; struct1.f3 = [1 2 3 4 9454];

struct2.f1 = {[1 23 4], ‘cheese’, 343, ‘a’}; struct2.f2 = ‘this is a struct’; struct2.f3 = ‘goat’;

scalar_var = 3; vect_var = [6 34 2 5 3]; mat_var = randn(5); char_var = ‘qwerty’; log_var = false; cell_var = {‘a’, 234, [6 5 3]};

varnames = {‘scalar_var’,’vect_var’,’mat_var’,’char_var’,’log_var’,’cell_var’,’struct1’,’struct2’}; create_log(varnames, ‘run_prefix’, ‘myrun’, ‘ID_len’, 7);

See also: generate_run_log, struct2codestr

∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿