function  trans = PLEtrans_by_sbj(S)

%PLETRANS_BY_SBJ -- Fine-grained PercLearn dynamics, PLExp1 data by sbj.
%
% S = PLEdata_by_sbj ; trans = PLEtrans_by_sbj(S)
%   trans = 
%      zP320c: [320x13 double]    % zP correct by subblock, congr. stim
%      zP320i: [320x13 double]    % zP correct by subblock, incongruent
%    contextc: [20x13 double]     % averaged over 5 switch transitions
%    contexti: [20x13 double]
%      nightc: [20x13 double]     % averaged over 7 overnight transit's
%      nighti: [20x13 double]
%      blockc: [20x13 double]     % the remaining 19 "baseline" transit's
%      blocki: [20x13 double]
%
% See function PLModel1\simul\PLM_transitions.m  for details.
% 
% See also PLM_TRANSITIONS, PLEDATA_BY_SBJ, PACK_FIELDS.

% Original coding by Alexander Petrov, UC Irvine.
% $Revision: 1.0 $  $Date: 2003/03/04 16:35 $

for k = 1:length(S)
   miss_idx = S(k).miss_idx ;
   stim_congr = 2 - S(k).data(:,6) ;   % 1="congr", 2="incongr"
   stim_congr(miss_idx) = [] ;         % [9600x1]
   resp_correct = S(k).data(:,8) ; 
   resp_correct(miss_idx) = [] ;       % [9600x1]
   tr(k) = PLM_transitions(stim_congr,resp_correct) ;
end

trans = pack_fields(tr,[],'cols2cols') ;

%--- Return TRANS
%%%%% End of PLETRANS_BY_SBJ.M
