Home > bml > io > bml_neuroomega_info_file.m

bml_neuroomega_info_file

PURPOSE ^

BML_NEUROOMEGA_INFO_FILE returns table with OS info of each neuroomega.mat file in a folder

SYNOPSIS ^

function info = bml_neuroomega_info_file(cfg)

DESCRIPTION ^

 BML_NEUROOMEGA_INFO_FILE returns table with OS info of each neuroomega.mat file in a folder

 Use as
   tab = bml_neuroomega_info_file(cfg);

 Same as BML_INFO_FILE but extracts depth and filenumber from filename.

 The first argument cfg is a configuration structure, which can contain
 the following field:
 cfg.path - string: path to the folder containing the .mat files. Defauts to '.'
 cfg.pattern - string: file name pattern (defaults to '*.mat')
 cfg.moving_files - logical: should Moving Files (MF) be loaded. Defaults to true.  
 cfg.regexp - string: regular expression to filter files (defaults to '[RL]T[1-5]D[-]{0,1}\d+\.\d+([+-]M){0,1}F\d+\.mat')

 Returns a matlab 'table' with the folloing variables:
   name - cell array of char: filename
   folder - cell array of char: path
   date - cell array of char: data of file creation 
   bytes - double: Size of the file in bytes
   isdir - logical: 1 if name is a folder; 0 if name is a file
   datenum - double: Modification date as serial date number.
   depth - double: depth of the electrodes as extracted from the file name
   filenum - double: index of the file at the specified depth

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function info = bml_neuroomega_info_file(cfg)
0002 
0003 % BML_NEUROOMEGA_INFO_FILE returns table with OS info of each neuroomega.mat file in a folder
0004 %
0005 % Use as
0006 %   tab = bml_neuroomega_info_file(cfg);
0007 %
0008 % Same as BML_INFO_FILE but extracts depth and filenumber from filename.
0009 %
0010 % The first argument cfg is a configuration structure, which can contain
0011 % the following field:
0012 % cfg.path - string: path to the folder containing the .mat files. Defauts to '.'
0013 % cfg.pattern - string: file name pattern (defaults to '*.mat')
0014 % cfg.moving_files - logical: should Moving Files (MF) be loaded. Defaults to true.
0015 % cfg.regexp - string: regular expression to filter files (defaults to '[RL]T[1-5]D[-]{0,1}\d+\.\d+([+-]M){0,1}F\d+\.mat')
0016 %
0017 % Returns a matlab 'table' with the folloing variables:
0018 %   name - cell array of char: filename
0019 %   folder - cell array of char: path
0020 %   date - cell array of char: data of file creation
0021 %   bytes - double: Size of the file in bytes
0022 %   isdir - logical: 1 if name is a folder; 0 if name is a file
0023 %   datenum - double: Modification date as serial date number.
0024 %   depth - double: depth of the electrodes as extracted from the file name
0025 %   filenum - double: index of the file at the specified depth
0026 
0027 cfg.pattern  = bml_getopt(cfg,'pattern','*.mat');
0028 moving_files = bml_getopt(cfg,'moving_files',true); 
0029 if moving_files
0030   cfg.regexp   = bml_getopt(cfg,'regexp','[RL]T[1-5]D[-]{0,1}\d+\.\d+([+-]M){0,1}F\d+\.mat');
0031 else
0032   cfg.regexp   = bml_getopt(cfg,'regexp','[RL]T[1-5]D[-]{0,1}\d+\.\d+F\d+\.mat');
0033 end
0034 
0035 info = bml_info_file(cfg);
0036 
0037 if ~isempty(info)
0038   info.depth = cellfun(@(x) str2double(regexp(x,'-?\d+\.\d+','match')), info.name);
0039   info.filenum = cellfun(@(x) str2double(regexp(x,'F(\d+)\.mat','tokens','once')), info.name);
0040 else
0041   warning("no files found");
0042 end
0043 
0044

Generated on Tue 25-Sep-2018 10:08:19 by m2html © 2005