stim_meas_list

PURPOSE ^

STIM_MEAS_LIST: mk stimulation pattern from list of electrodes

SYNOPSIS ^

function [stim, meas_sel]= stim_meas_list( sp_mp , Nelec, current, gain);

DESCRIPTION ^

STIM_MEAS_LIST: mk stimulation pattern from list of electrodes
 [stim, meas_sel]= stim_meas_list( sp_mp , Nelec, amplitude, gain);

 stim =    EIDORS stimulation structure
     use: fwd_model.stimulation = stim;
 meas_sel =EIDORS meas_select (select all values specified)
                to form part of a fwd_model object

 sp_mp = matrix [stim+, stim-, meas+, meas-] x N_patterns

 Nelec  = Num of electrodes         DEFAULT = max sp_mp
 current= drive current levels,     DEFAULT = 1mA
 gain   = gain on voltage channels  DEFAULT = 1

 example: stim_meas_list([1,2,3,4; 1,2,4,5])
    create stim pattern in to elecs 1,2 with differential
    measurements on electrodes 3,4 and 4,5

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [stim, meas_sel]= stim_meas_list( sp_mp , Nelec, current, gain);
0002 %STIM_MEAS_LIST: mk stimulation pattern from list of electrodes
0003 % [stim, meas_sel]= stim_meas_list( sp_mp , Nelec, amplitude, gain);
0004 %
0005 % stim =    EIDORS stimulation structure
0006 %     use: fwd_model.stimulation = stim;
0007 % meas_sel =EIDORS meas_select (select all values specified)
0008 %                to form part of a fwd_model object
0009 %
0010 % sp_mp = matrix [stim+, stim-, meas+, meas-] x N_patterns
0011 %
0012 % Nelec  = Num of electrodes         DEFAULT = max sp_mp
0013 % current= drive current levels,     DEFAULT = 1mA
0014 % gain   = gain on voltage channels  DEFAULT = 1
0015 %
0016 % example: stim_meas_list([1,2,3,4; 1,2,4,5])
0017 %    create stim pattern in to elecs 1,2 with differential
0018 %    measurements on electrodes 3,4 and 4,5
0019 
0020 % (C) 2010 Andy Adler. License: GPL version 2 or version 3
0021 % $Id: stim_meas_list.html 2819 2011-09-07 16:43:11Z aadler $
0022 
0023 if isstr(sp_mp) && strcmp(sp_mp,'UNIT_TEST'); do_unit_test; return; end
0024 
0025 if nargin <2; Nelec = max(sp_mp(:)); end
0026 if nargin <3; current = 1;           end
0027 if nargin <4; gain    = 1;           end
0028 
0029 stim = struct([]);
0030 Npat = size(sp_mp,1);
0031 for i=1:Npat
0032    stim(i).stimulation = 'mA';
0033    cur = sp_mp(i,1:2); 
0034    stim(i).stim_pattern = sparse( cur, 1, current*[-1,1], Nelec,1);
0035    mes = sp_mp(i,3:4); 
0036    stim(i).meas_pattern = sparse( 1, mes, gain *  [-1,1], 1, Nelec);
0037 end
0038 
0039 function  do_unit_test
0040    imdl = mk_common_model('a2c0',16);
0041    img = mk_image(imdl);
0042    img.fwd_model.stimulation = stim_meas_list([1,2,3,4;1,2,4,5],16);
0043    vh = fwd_solve(img);

Generated on Tue 09-Aug-2011 11:38:31 by m2html © 2005