Home > database > mysql_get_expstims.m

mysql_get_expstims

PURPOSE ^

Retrieves auditory stimuli associated with a given response table.

SYNOPSIS ^

function [stiminfo, stim_fields] = mysql_get_expstims(resp_tbl,varargin)

DESCRIPTION ^

 Retrieves auditory stimuli associated with a given response table.
 [stiminfo] = mysql_get_expstims(resp_tbl,varargin)

 Retrieves list of auditory stimuli (and associated info) of all stimuli that are
 associated with a response table.

 'conn_id' <conn_id> is REQUIRED

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [stiminfo, stim_fields] = mysql_get_expstims(resp_tbl,varargin)
0002 % Retrieves auditory stimuli associated with a given response table.
0003 % [stiminfo] = mysql_get_expstims(resp_tbl,varargin)
0004 %
0005 % Retrieves list of auditory stimuli (and associated info) of all stimuli that are
0006 % associated with a response table.
0007 %
0008 % 'conn_id' <conn_id> is REQUIRED
0009 
0010 % 12/29/07 Petr Janata
0011 % 06/15/10 PJ - sanitized mysql_make_conn
0012 
0013 stiminfo = {};
0014 
0015 % Parse the input arguments
0016 narg = length(varargin);
0017 for iarg = 1:2:narg
0018   switch varargin{iarg}
0019     case 'conn_id'
0020       conn_id = varargin{iarg+1};
0021     otherwise
0022       fprintf('mysql_get_expstims: Unknown input argument: %s\n', varargin{iarg});
0023   end
0024 end
0025 
0026 % Check for valid connection to database
0027 if ~exist('conn_id','var') || isempty(conn_id) || mysql(conn_id,'status')
0028   error('%s: Do not have a valid connection ID', mfilename);
0029 end
0030 
0031 % Get list of stimulus IDs that are in the response table
0032 mysql_str = sprintf(['SELECT DISTINCT stimulus_id FROM %s ' ...
0033       'WHERE stimulus_id IS NOT NULL;'], resp_tbl);
0034 [stimids] = mysql(conn_id,mysql_str);
0035 
0036 [stiminfo, stim_fields] = mysql_get_stim_attributes('stimulus_id',stimids,conn_id);
0037 
0038 return
0039 
0040

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003