Padaco  1.6
Toolbox for interpreting Actigraph accelerometer data collected from children in order to better understand their physical activity and sleep patterns with the intent of reducing obesity and improving their overall health.
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PASettings Class Reference

PASettings used by Padaco to initialize, store, and update user preferences. The class is designed for storage and manipulation of the user settings relating to Padaco. More...

Inheritance diagram for PASettings:

Public Member Functions

function PASettings (in rootpathname, in parameters_filename)
 Class constructor. More...
 
function initialize (in obj)
 Constructor helper function. Initializes class either from parameters_filename if such a file exists, or hardcoded default values (i.e. setDefaults). More...
 
function defaultsEditor (in obj, in optional_fieldName)
 Activates GUI for editing single study mode settings (VIEW,PSD,MUSIC) More...
 
function saveParametersToFile (in obj, in dataStruct2Save, in filename)
 saves all of the fields in saveStruct to the file filename as a .txt file More...
 
function setDefaults (in obj, in fieldNames)
 sets default values for the class parameters listed in the input argument fieldNames. More...
 

Static Public Member Functions

static function loadParametersFromFile (in filename)
 Returns a structure of parameters parsed from the text file identified by the the input filename. Parameters in the text file are stored per row using the following form: More...
 
static function loadXMLStruct (in xmlFilename)
 Parses the XML file and returns an array of structs. More...
 
static function loadStruct (in fid, in pstruct)
 Parses the file with file identifier fid to find structure and substructure value pairs. If pstruct is passed as an input argument then the file substructure and value pairings will be put into it as new or overwriting fields and subfields. If pstruct is not included then a new/original structure is created and returned. fid must be open for this to work. fid is not closed at the end of this function. More...
 
static function tokens2struct (in pstruct, in tok)
 helper function for loadStruct More...
 
static function str2vec (in str, in delim)
 Converts a string of space delimited numerics to a vector of numbers. More...
 
static function saveStruct (in fid, in root, in varargin)
 Saves the root structure to the file with file identifier fid. to display the output to the screen set fid=1 Note: the root node of a structure is not saved as a field to fid. See the second example on how to save the root node if desired. More...
 
static function strcat_with_dot (in root, in varargin)
 helper function for loadStruct More...
 

Public Attributes

Property rootpathname
 Keeps track of the folder that padaco is run from. This is useful when saving the setting's file to make sure it is always saved in the same place and not in another directory (e.g. if the user moves about in MATLAB's editor). More...
 
Property parameters_filename
 name of text file that stores the toolkit's settings More...
 
Property fieldNames
 cell of string names corresponding to the struct properties that contain settings {'DATA','VIEW', 'CONTROLLER','BATCH'} More...
 
Property CONTROLLER
 struct of PAController preferences. More...
 
Property DATA
 struct of PAData preferences. More...
 
Property VIEW
 struct of viewer related settings. More...
 
Property BATCH
 struct of batch processing settings. More...
 
Property StatTool
 struct of StatTool plot/analysis settings. More...
 

Detailed Description

PASettings used by Padaco to initialize, store, and update user preferences. The class is designed for storage and manipulation of the user settings relating to Padaco.

Note
: This file was originally taken from SEV's CLASS_settings class, by permission of the author Hyatt Moore.

Constructor & Destructor Documentation

function PASettings::PASettings ( in  rootpathname,
in  parameters_filename 
)

Class constructor.

Stores the root path and parameters file and invokes initialize method. Default settings are used if no parameters filename is provided or found.

Parameters
rootpathnamePathname of Padaco execution directory (string)
parameters_filenameName of text file to load settings from (string)
Returns
obj Instance of PASettings class.

Member Function Documentation

function PASettings::defaultsEditor ( in  obj,
in  optional_fieldName 
)

Activates GUI for editing single study mode settings (VIEW,PSD,MUSIC)

Parameters
objinstance of PASettings class.
optional_fieldName(Optional) String indicating which settings to update. Can be
  • StatTool
  • VIEW
  • BATCH
  • CONTROLLER
Return values
wasModifieda boolean value; true if any changes were made to the settings in the GUI and false otherwise.
function PASettings::initialize ( in  obj)

Constructor helper function. Initializes class either from parameters_filename if such a file exists, or hardcoded default values (i.e. setDefaults).

Parameters
objinstance of the PASettings class.
static function PASettings::loadParametersFromFile ( in  filename)
static

Returns a structure of parameters parsed from the text file identified by the the input filename. Parameters in the text file are stored per row using the following form:

  • fieldname1 value1
  • fieldname2 value2
  • .... an optional ':' is allowed after the fieldname such as fieldname: value The parameters is
Parameters
filenameString identifying the filename to load.
Return values
paramStructStructure that contains the listed fields found in the file 'filename' along with their corresponding values
static function PASettings::loadStruct ( in  fid,
in  pstruct 
)
static

Parses the file with file identifier fid to find structure and substructure value pairs. If pstruct is passed as an input argument then the file substructure and value pairings will be put into it as new or overwriting fields and subfields. If pstruct is not included then a new/original structure is created and returned. fid must be open for this to work. fid is not closed at the end of this function.

Parameters
fidfile identifier to parse
pstruct(optional) If included, pstruct fields will be overwritten if existing, otherwise they will be added and returned.
Return values
pstructreturn value of tokens2struct call.
static function PASettings::loadXMLStruct ( in  xmlFilename)
static

Parses the XML file and returns an array of structs.

Parameters
xmlFilenameName of the XML file to parse (absolute path)
Return values
xmlStructA structure containing the elements and associated attributes of the xml as parsed by xml_read.
function PASettings::saveParametersToFile ( in  obj,
in  dataStruct2Save,
in  filename 
)

saves all of the fields in saveStruct to the file filename as a .txt file

Parameters
objinstance of PASettings class.
dataStruct2Save(optional) structure of parameters and values to save to the text file identfied by obj property filename or the input paramater filename. Enter empty (i.e., []) to save all available fields
filename(optional) name of file to save parameters to. If it is not included then the save file is taken from the instance variables rootpathname and parameters_filename
static function PASettings::saveStruct ( in  fid,
in  root,
in  varargin 
)
static

Saves the root structure to the file with file identifier fid. to display the output to the screen set fid=1 Note: the root node of a structure is not saved as a field to fid. See the second example on how to save the root node if desired.

function PASettings::setDefaults ( in  obj,
in  fieldNames 
)

sets default values for the class parameters listed in the input argument fieldNames.

Parameters
objinstance of PASettings.
fieldNames(optional) string identifying which of the object's parameters to reset. Multiple field names may be listed using a cell structure to hold additional strings. If no argument is provided or fieldNames is empty then object's fieldNames property is used and all parameter structs are reset to their default values.
static function PASettings::str2vec ( in  str,
in  delim 
)
static

Converts a string of space delimited numerics to a vector of numbers.

Parameters
strA string of numbers. For example str = '0 0 0'
delimOptional delimiter to use. Default is white space.
Return values
vecA vector of numeric values corresponding the str values. For example if str = '0 0 0' then vec = [0 0 0]
Note
NaN is returned if the entire string cannot be converted to a vector. For example if str = '0 'lkj 0 0' then vec = NaN
static function PASettings::strcat_with_dot ( in  root,
in  varargin 
)
static

helper function for loadStruct

static function PASettings::tokens2struct ( in  pstruct,
in  tok 
)
static

helper function for loadStruct

Parameters
pstructparent struct by which the tok cell will be converted to
tokcell array - the last cell is the value to be assigned while the previous cells are increasing nestings of the structure (i.e. tok{1} is the highest parent structure, tok{2} is the substructure of tok{1} and so and on and so forth until tok{end-1}. tok{end} is the value to be assigned. the tok structure is added as a child to the parent pstruct.
Return values
pstructInput pstruct with any additional tok children added.

Member Data Documentation

Property PASettings::BATCH

struct of batch processing settings.

Property PASettings::CONTROLLER

struct of PAController preferences.

Property PASettings::DATA

struct of PAData preferences.

Property PASettings::fieldNames

cell of string names corresponding to the struct properties that contain settings {'DATA','VIEW', 'CONTROLLER','BATCH'}

Property PASettings::parameters_filename

name of text file that stores the toolkit's settings

Property PASettings::rootpathname

Keeps track of the folder that padaco is run from. This is useful when saving the setting's file to make sure it is always saved in the same place and not in another directory (e.g. if the user moves about in MATLAB's editor).

pathname of Padaco working directory - determined at run time.

Property PASettings::StatTool

struct of StatTool plot/analysis settings.

Property PASettings::VIEW

struct of viewer related settings.


The documentation for this class was generated from the following file: