Skip to content
Gabe Nespoli edited this page Nov 13, 2018 · 12 revisions

Welcome to the PHZLAB wiki! See the sidebar for the table of contents.

Introduction to PHZLAB

Welcome to PHZLAB! PHZLAB is a MATLAB toolbox for processing, analyzing, and visualizing multiple-trial time-series data. Since there is no graphical user interface (GUI) PHZLAB is used via the command line or custom scripts instead of clicking on buttons and menu items. However, PHZLAB functions are designed to operate as if they were menu items. Instead of pointing, clicking, and filling fields with options, the user just types these things in. I have adopted this philosophy with the hope that PHZLAB can serve as a tool for learning MATLAB generally, as well as enabling the user to complete an entire analysis without too much programming expertise. This page should help you understand how PHZLAB represents your data and how its functions are structured, so that writing a custom script is just as easy as clicking through menus.

PHZLAB was created to analyze multi-trial time-series data (a trials-by-time numeric matrix, in MATLAB speak), and revolves around a single struct variable, PHZ. In addition to holding the actual data (in the PHZ.data field) the PHZ struct holds a number of metadata elements, such as the participant number each trial belongs to, the epoch times you used, or the complete history of PHZLAB functions that have touched this PHZ.

The PHZ struct

To create a blank PHZ struct, type the following into a MATLAB command window. This will create a variable named PHZ and display its contents, like below:

>> PHZ = phz_create('blank')

  PHZ structure created.

PHZ =

  struct with fields:

          study: ''
       datatype: ''
    participant: -
          group: -
      condition: -
        session: -
         trials: -
         region: [1x1 struct]
          times: []
           data: []
          units: ''
          srate: []
           resp: [1x1 struct]
           proc: [1x1 struct]
            lib: [1x1 struct]
            etc: [1x1 struct]
        history: {'29-Oct-2018 11:36:25 phz_create.m>> PHZ structure created.'}

Most PHZLAB functions operate on the PHZ variable. This means that PHZLAB can change all the metadata as well as the actual data. It also means that PHZLAB can run phz_check, which makes sure that the PHZ struct is in good shape. If you ever need to modify PHZ manually, it can be a good idea to run PHZ = phz_check(PHZ); afterwards. Also all PHZLAB functions start with phz_, meaning function names are likely unique and won't override those in other toolboxes.

% subtract the mean of the baseline region
PHZ = phz_blsub(PHZ, 'baseline');

For a complete reference of the fields, see The PHZ struct section.