From Bcontrol
Revision as of 18:52, 19 May 2008 by Jerlich (talk | contribs)

There are two functions supported by the sqlsummary plugin:


This plugin lets you call a single command:


that will send a summary of your session to a mysql server.

 function [err]=sendsummary(obj, varargin)
 pairs = { ...
 		'hits'			get_val('hit_history');...
 		'sides'			get_val('previous_sides');...
 		'endtime'		datestr(now,13);...
 		'sessiondate'		datestr(now,29);...
 		'hostname'		get_val('SavingSection_hostname');...
 		'experimenter'		get_val('SavingSection_experimenter');...
 		'ratname'		get_val('SavingSection_ratname');...
 		'n_done_trials'		get_val('n_done_trials');...
 		'protocol'		class(obj);...
 		'protocol_data'		'NULL'
 		}; parseargs(varargin, pairs);
 %% Get the relevant SPH

With no extra arguments sendsummary tries to generate a summary making the following assumptions:

  1. There is a SoloParamHandle named hit_history that contains a numeric array containing a 1 for every correct trial, a 0 for incorrect trials and NaN for trials that should not be treated as correct or incorrect.
  2. There is a SoloParamHandle named previous_sides that contains a string of l's and r's to indicate whether the correct response was towards the left or the right.
  3. That the @saveload plugin is being used.

You can still use this function if the above assumptions are false. In this case, pass in the appropriate information as parameters.

For example, you don't have an SPH called previous_sides but rather you store this information in sides_history and it is made up of -1's and 1's. In this case, write a little bit of code to transform your sides_history into a string of l's and r's and then send the string as an argument to sendsummary.

 lets={'l' 'c' 'r'};
 sendsummary(obj, 'sides',sides)

The other feature worth noting is the protocol_data field. You can build any struct or cell array you like and pass it in. For example:


The advantage of this is that you can then write code that grabs the protocol_data for a specific set of sessions and runs through some analysis without having to load the entire data file for each session. This could significantly simplify analysis of behavior and replace hunt. The only constraint is that you cannot use sparse matrices in this field. This is a limitation of mym.

NOTE: Currently this functionality is only supported for the Brody Lab. Users outside of the brody lab must set up a mysql server for their lab and replace the bdata.p file found in ExperPort/MySQLUtility using bdata_template.m.

Jerlich 20:23, 29 December 2007 (EST)