Browse code

new LabelMap new svm grouping method

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@100 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on07/01/2009 18:26:33
Showing8 changed files
... ...
@@ -1,26 +1,73 @@
1
-function map = LabelMap(label,value)
1
+function map = LabelMap(varargin)
2 2
 %LabelMap(labelCellList,valueCellList) maps Label to Classvalues suitable for
3 3
 %SVM
4 4
 
5
-if nargin == 2
6
-    if ~ (iscell(label) && iscell(value))
7
-        error('LabelMap:Constructor:argsNoCell','Arguments have to be CellArrays. Vectors not yet supported. sorry.');
8
-    end   
9
-    if(any(size(label) ~= size(value)))
10
-        error('LabelMap:Constructor:sizeDontMatch','Label List and Value List must be the same size!');
11
-    end
12
-    
13
-    map.labelToValue = java.util.HashMap;
14
-    map.valueToLabel = java.util.HashMap;
15
-    
16
-    for i = 1:max(size(label)) % cell array is 1:x or x:1, indexing is same
17
-       map.labelToValue.put(label{i},value{i}); 
18
-       map.valueToLabel.put(value{i},label{i});
19
-    end
20
-    
21
-    map = class(map,'LabelMap');
22
-else
23
-    error('LabelMap:Constructor:noArgs','Sorry, default constructor not supported yet!');
5
+switch nargin
6
+    case 2
7
+        condition = varargin{2};
8
+        label     = varargin{1};
9
+        svmvalue  = 'auto';
10
+    case 3
11
+        condition = varargin{2};
12
+        label     = varargin{1};
13
+        svmvalue  = varargin{3};
14
+    otherwise
15
+        error('LabelMap:Constructor:wrongArgs','Wrong Arguments!');
24 16
 end
25 17
 
26
-end
27 18
\ No newline at end of file
19
+
20
+%         if ~ (iscell(label) && iscell(condition))
21
+%             error('LabelMap:Constructor:argsNoCell','Arguments have to be CellArrays. Vectors not yet supported. sorry.');
22
+%         end
23
+%         if(any(size(label) ~= size(value)))
24
+%             error('LabelMap:Constructor:sizeDontMatch','Label List and Value List must be the same size!');
25
+%         end
26
+
27
+        map.ConditionToLabel = java.util.HashMap;
28
+        map.LabelToCondition = java.util.HashMap;
29
+        map.LabelToValue     = java.util.HashMap;
30
+        map.ValueToLabel     = java.util.HashMap;
31
+        
32
+        
33
+        % condition: {[a,b,c],[d,e,f],...}
34
+        
35
+        for conditionGroupCellID = 1:numel(condition) % cells
36
+            conditionGroupVector = condition{conditionGroupCellID};
37
+
38
+            for conditionID = 1:size(conditionGroupVector,2)
39
+               conditionLabel = cell2mat(label(conditionGroupCellID));
40
+               
41
+               map.ConditionToLabel.put(conditionGroupVector(conditionID),conditionLabel);
42
+               if ~map.LabelToCondition.containsKey(conditionLabel)
43
+                   conditionset = java.util.HashSet;
44
+                   map.LabelToCondition.put(conditionLabel,conditionset);
45
+               end
46
+              map.LabelToCondition.get(conditionLabel).add(conditionGroupVector(conditionID));
47
+           end
48
+        end
49
+        
50
+        for labelid = 1:numel(label)
51
+            if map.LabelToValue.containsKey(label)
52
+                continue;
53
+            end
54
+            
55
+            if ~iscell(svmvalue) || strcmp(cell2mat(svmvalue),'auto')
56
+               map.LabelToValue.put(cell2mat(label(labelid)),labelid);
57
+               map.ValueToLabel.put(labelid,cell2mat(label(labelid)));
58
+            else
59
+               map.LabelToValue.put(cell2mat(label(labelid)),cell2mat(svmvalue(labelid)));
60
+               map.ValueToLabel.put(cell2mat(svmvalue(labelid)),cell2mat(label(labelid)));
61
+            end    
62
+        end
63
+
64
+        
65
+
66
+%         for i = 1:max(size(label)) % cell array is 1:x or x:1, indexing is same
67
+%             map.labelToValue.put(label{i},value{i});
68
+%             map.valueToLabel.put(value{i},label{i});
69
+%         end
70
+
71
+        map = class(map,'LabelMap');
72
+
73
+
74
+end
... ...
@@ -1,6 +1,6 @@
1
-function label = getLabel(mapping,classValue)
2
-if mapping.valueToLabel.containsKey(classValue)
3
-    label = mapping.valueToLabel.get(classValue);   
1
+function label = getLabel(mapping,condition)
2
+if mapping.ConditionToLabel.containsKey(condition)
3
+    label = mapping.ConditionToLabel.get(condition);   
4 4
 else
5
-     error('LabelMap:getLabel:noSuchValue','this Mapping does not contain a Value %d',classValue);
5
+     error('LabelMap:getLabel:noSuchValue','this Mapping does not contain a Value %d',condition);
6 6
 end
7 7
\ No newline at end of file
... ...
@@ -1,6 +1,6 @@
1 1
 function value = getValue(mapping,classLabel)
2
-if mapping.labelToValue.containsKey(classLabel)
3
-    value = mapping.labelToValue.get(classLabel);   
2
+if mapping.LabelToValue.containsKey(classLabel)
3
+    value = mapping.LabelToValue.get(classLabel);   
4 4
 else
5 5
      error('LabelMap:getValue:noSuchLabel','this Mapping does not contain a Label ''%s''',classLabel);
6 6
 end
7 7
\ No newline at end of file
... ...
@@ -4,14 +4,15 @@ function m = SubjectRoiMapping(argv)
4 4
 %   normally called without any arguments
5 5
 
6 6
 if nargin == 0
7
-    m.subject{1}='HIGL5';
8
-    m.subject{2}='AXLI5';
9
-    m.subject{3}='SHWA5';
10
-    m.subject{4}='DAPR5';
11
-    m.subject{5}='5IGKA';
12
-    m.subject{6}='5RAEL';
13
-    m.subject{7}='5JEZI';
14
-    m.subject{8}='5PK002';
7
+    m.subject{1} ='AI020';
8
+    m.subject{2} ='BD001';
9
+    m.subject{3} ='HG027';
10
+    m.subject{4} ='IK011';
11
+    m.subject{5} ='JZ006'; % Guter Proband
12
+    m.subject{6} ='LB001';
13
+    m.subject{7} ='SW007';
14
+    m.subject{8} ='VW005';
15
+
15 16
     m.subjectNameMap = java.util.HashMap;
16 17
     for subj = 1:size(m.subject,2)
17 18
         m.subjectNameMap.put(m.subject{subj},subj);
... ...
@@ -19,15 +20,19 @@ if nargin == 0
19 20
     
20 21
     
21 22
     
22
-    m.roi_name{1}='SPL l';
23
-    m.roi_name{2}='SPL r';
24
-    m.roi_name{3}='dPM l';
25
-    m.roi_name{4}='dPM r';
26
-    m.roi_name{5}='DLPFC l';
27
-    m.roi_name{6}='DLPFC r';
28
-    m.roi_name{7}='SMA l';
29
-    m.roi_name{8}='antIPS l';
30
-
23
+    m.roi_name{1}  ='SPL l'; % <-Parietalkortex links 
24
+    m.roi_name{2}  ='SPL r'; % <-Parietalkortex rechts 
25
+    m.roi_name{3}  ='PMd l'; 
26
+    m.roi_name{4}  ='PMd r'; 
27
+    m.roi_name{5}  ='IPSa l'; 
28
+    m.roi_name{6}  ='IPSa r'; 
29
+    m.roi_name{7}  ='SMA'; 
30
+    m.roi_name{8}  ='DLPFC'; 
31
+    m.roi_name{9}  ='V1 l'; 
32
+    m.roi_name{10} ='V1 r'; 
33
+    m.roi_name{11} ='M1 l'; % <-Motorischer Cortex l 
34
+    m.roi_name{12} ='M1 r'; % <-Motorischer Cortex r 
35
+    
31 36
     m.roiNameMap = java.util.HashMap;
32 37
     for roi = 1:size(m.roi_name,2)
33 38
         m.roiNameMap.put(m.roi_name{roi},roi);
... ...
@@ -35,77 +40,103 @@ if nargin == 0
35 40
 
36 41
     
37 42
     % Koordinaten aller Probanden A von den ROIS B: rois{A}(B,[x y z in mm]) 
38
-    m.coordinate{1}(1,:)=[-15 -66 60];
39
-    m.coordinate{1}(2,:)=[18 -63 63];
40
-    m.coordinate{1}(3,:)=[-24 -6 57];
41
-    m.coordinate{1}(4,:)=[27 -9 54];
42
-    m.coordinate{1}(5,:)=[-42 30 39];
43
-    m.coordinate{1}(6,:)=[36 45 21];
44
-    m.coordinate{1}(7,:)=[-3 6 60];
45
-    m.coordinate{1}(8,:)=[-33 -39 42];
46
-
47
-    m.coordinate{2}(1,:)=[-15 -66 66];
48
-    m.coordinate{2}(2,:)=[15 -69 63];
49
-    m.coordinate{2}(3,:)=[-30 -9 63];
50
-    m.coordinate{2}(4,:)=[33 -6 60];
51
-    m.coordinate{2}(5,:)=[-30 39 42];
52
-    m.coordinate{2}(6,:)=[36 36 42];
53
-    m.coordinate{2}(7,:)=[-3 0 63];
54
-    m.coordinate{2}(8,:)=[-39 -42 60];
55
-
56
-    m.coordinate{3}(1,:)=[-18 -63 57];
57
-    m.coordinate{3}(2,:)=[15 -69 60];
58
-    m.coordinate{3}(3,:)=[-24 -12 51];
59
-    m.coordinate{3}(4,:)=[27 -12 51];
60
-    m.coordinate{3}(5,:)=[-27 36 42];
61
-    m.coordinate{3}(6,:)=[30 42 42];
62
-    m.coordinate{3}(7,:)=[-3 -6 63];
63
-    m.coordinate{3}(8,:)=[-36 -51 60];
64
-
65
-    m.coordinate{4}(1,:)=[-30 -54 63];
66
-    m.coordinate{4}(2,:)=[18 -60 54];
67
-    m.coordinate{4}(3,:)=[-33 -6 57];
68
-    m.coordinate{4}(4,:)=[27 -6 57];
69
-    m.coordinate{4}(5,:)=[-27 33 27];
70
-    m.coordinate{4}(6,:)=[nan nan nan];
71
-    m.coordinate{4}(7,:)=[-6 3 60];
72
-    m.coordinate{4}(8,:)=[-33 -51 54];
73
-
74
-    m.coordinate{5}(1,:)=[-21 -63 66];
75
-    m.coordinate{5}(2,:)=[24 -54 66];
76
-    m.coordinate{5}(3,:)=[-30 -6 51];
77
-    m.coordinate{5}(4,:)=[21 0 57];
78
-    m.coordinate{5}(5,:)=[-33 36 27];
79
-    m.coordinate{5}(6,:)=[33 45 30];
80
-    m.coordinate{5}(7,:)=[-6 -3 54];
81
-    m.coordinate{5}(8,:)=[-39 -42 54];
82
-
83
-    m.coordinate{6}(1,:)=[-15 -69 54];
84
-    m.coordinate{6}(2,:)=[21 -63 57];
85
-    m.coordinate{6}(3,:)=[-24 -9 66];
86
-    m.coordinate{6}(4,:)=[33 -6 66];
87
-    m.coordinate{6}(5,:)=[-33 30 39];
88
-    m.coordinate{6}(6,:)=[33 45 30];
89
-    m.coordinate{6}(7,:)=[-3 0 54];
90
-    m.coordinate{6}(8,:)=[-39 -42 39];
91
-
92
-    m.coordinate{7}(1,:)=[-12 -66 63];
93
-    m.coordinate{7}(2,:)=[15 -66 63];
94
-    m.coordinate{7}(3,:)=[-21 -9 54];
95
-    m.coordinate{7}(4,:)=[30 -9 57];
96
-    m.coordinate{7}(5,:)=[-39 33 33];
97
-    m.coordinate{7}(6,:)=[39 30 33];
98
-    m.coordinate{7}(7,:)=[-6 0 54];
99
-    m.coordinate{7}(8,:)=[-39 -45 54];
43
+    m.coordinate{1}(1,:)  = [-18, -78, 53];
44
+    m.coordinate{1}(2,:)  = [12, -69, 46];
45
+    m.coordinate{1}(3,:)  = [-21, -12, 49];
46
+    m.coordinate{1}(4,:)  = [30, -12, 53];
47
+    m.coordinate{1}(5,:)  = [-30, -51, 39];
48
+    m.coordinate{1}(6,:)  = [ 33, -60, 49];
49
+    m.coordinate{1}(7,:)  = [ -9, 6, 46];
50
+    m.coordinate{1}(8,:)  = [-27 27 48];
51
+    m.coordinate{1}(9,:)  = [-6, -90, -7];
52
+    m.coordinate{1}(10,:) = [12, -90, -4];
53
+    m.coordinate{1}(11,:) = [-57, -24, 49];
54
+    m.coordinate{1}(12,:) = [42, -24, 60];
55
+    m.coordinate{2}(1,:)  = [-9, -72, 56]; 
56
+    m.coordinate{2}(2,:)  = [15, -72, 60]; 
57
+    m.coordinate{2}(3,:)  = [-30, -9, 53]; 
58
+    m.coordinate{2}(4,:)  = [ 30, -9, 49]; 
59
+    m.coordinate{2}(5,:)  = [-42 -36 39]; 
60
+    m.coordinate{2}(6,:)  = [30 -36 42]; 
61
+    m.coordinate{2}(7,:)  = [ -3, 6, 53];
62
+    m.coordinate{2}(8,:)  = [-27 30 28];
63
+    m.coordinate{2}(9,:)  = [-6, -81, -7]; 
64
+    m.coordinate{2}(10,:) = [9, -78, -7];
65
+    m.coordinate{2}(11,:) = [-51, -24, 60];
66
+    m.coordinate{2}(12,:) = [48, -21, 63]; 
67
+    m.coordinate{3}(1,:)  = [-15, -72, 60];
68
+    m.coordinate{3}(2,:)  = [15, -66, 63];
69
+    m.coordinate{3}(3,:)  = [-27, -12, 56];
70
+    m.coordinate{3}(4,:)  = [24 -15 53];
71
+    m.coordinate{3}(5,:)  = [-36 -36 42];
72
+    m.coordinate{3}(6,:)  = [30 -39 35];
73
+    m.coordinate{3}(7,:)  = [-9, 3, 53]; 
74
+    m.coordinate{3}(8,:)  = [-30 30 28];
75
+    m.coordinate{3}(9,:)  = [-3, -90, 4];
76
+    m.coordinate{3}(10,:) = [15, -99, 14];
77
+    m.coordinate{3}(11,:) = [-27, -27, 74];
78
+    m.coordinate{3}(12,:) = [36, -27, 70]; 
79
+    m.coordinate{4}(1,:)  = [-21, -69, 63]; 
80
+    m.coordinate{4}(2,:)  = [21, -69, 63];
81
+    m.coordinate{4}(3,:)  = [-33 -12 53];
82
+    m.coordinate{4}(4,:)  = [12 -9 60];
83
+    m.coordinate{4}(5,:)  = [-33 -35 46];
84
+    m.coordinate{4}(6,:)  = [42 -36 39];
85
+    m.coordinate{4}(7,:)  = [-3 0 49];
86
+    m.coordinate{4}(8,:)  = [-33 33 28];
87
+    m.coordinate{4}(9,:)  = [-3, -90, -7];
88
+    m.coordinate{4}(10,:) = [9, -81, -7];
89
+    m.coordinate{4}(11,:) = [-39, -27, 53];
90
+    m.coordinate{4}(12,:) = [51, -24, 60];
91
+    m.coordinate{5}(1,:)  = [-12 -66 63];
92
+    m.coordinate{5}(2,:)  = [12, -75, 60];
93
+    m.coordinate{5}(3,:)  = [-24, -12, 53];
94
+    m.coordinate{5}(4,:)  = [27, -9, 60]; 
95
+    m.coordinate{5}(5,:)  = [-42 -42 35]; 
96
+    m.coordinate{5}(6,:)  = [33 -48 35];
97
+    m.coordinate{5}(7,:)  = [ -3, 0, 49];
98
+    m.coordinate{5}(8,:)  = [-36 33 28];
99
+    m.coordinate{5}(9,:)  = [-15, -93, -4];
100
+    m.coordinate{5}(10,:) = [15, -90, 4]; 
101
+    m.coordinate{5}(11,:) = [-39, -33, 67];
102
+    m.coordinate{5}(12,:) = [27, -18, 74];
103
+    m.coordinate{6}(1,:)  = [-21, -69, 60];
104
+    m.coordinate{6}(2,:)  = [9, -72, 63];
105
+    m.coordinate{6}(3,:)  = [-24 -12 53];
106
+    m.coordinate{6}(4,:)  = [32 -12 56]; 
107
+    m.coordinate{6}(5,:)  = [-36 -39 35];
108
+    m.coordinate{6}(6,:)  = [42 -33 46]; 
109
+    m.coordinate{6}(7,:)  = [-6 3 49]; 
110
+    m.coordinate{6}(8,:)  = [-36 33 28];
111
+    m.coordinate{6}(9,:)  = [-12, -99, 0];
112
+    m.coordinate{6}(10,:) = [9, -96, -7];
113
+    m.coordinate{6}(11,:) = [-48, -27, 60];
114
+    m.coordinate{6}(12,:) = [33, -33, 60];
115
+    m.coordinate{7}(1,:)  = [-21, -60, 56]; 
116
+    m.coordinate{7}(2,:)  = [12, -69, 60]; 
117
+    m.coordinate{7}(3,:)  = [-24, -12, 49];
118
+    m.coordinate{7}(4,:)  = [24, -6, 49]; 
119
+    m.coordinate{7}(5,:)  = [-33 -45 46]; 
120
+    m.coordinate{7}(6,:)  = [30, -51, 49];
121
+    m.coordinate{7}(7,:)  = [0, 9, 42]; 
122
+    m.coordinate{7}(8,:)  = [-30 36 35]; 
123
+    m.coordinate{7}(9,:)  = [-3, -84, -4];
124
+    m.coordinate{7}(10,:) = [18, -87, -7];
125
+    m.coordinate{7}(11,:) = [-36, -30, 63]; 
126
+    m.coordinate{7}(12,:) = [42, -27, 60];
127
+    m.coordinate{8}(1,:)  = [-27, -63, 53];
128
+    m.coordinate{8}(2,:)  = [18, -66, 56];
129
+    m.coordinate{8}(3,:)  = [-21, -6, 56];
130
+    m.coordinate{8}(4,:)  = [27 -6 53]; 
131
+    m.coordinate{8}(5,:)  = [-36, -51, 49];
132
+    m.coordinate{8}(6,:)  = [45, -39, 53];
133
+    m.coordinate{8}(7,:)  = [-9, 9, 53];
134
+    m.coordinate{8}(8,:)  = [-36 24 25]; 
135
+    m.coordinate{8}(9,:)  = [0, -90, 4]; 
136
+    m.coordinate{8}(10,:) = [0, -90, 4];
137
+    m.coordinate{8}(11,:) = [-42, -27, 67]; 
138
+    m.coordinate{8}(12,:) = [51, -27, 63]; 
100 139
 
101
-    m.coordinate{8}(1,:)=[-15 -72 51];
102
-    m.coordinate{8}(2,:)=[15 -75 51];
103
-    m.coordinate{8}(3,:)=[-27 -12 66];
104
-    m.coordinate{8}(4,:)=[33 -18 69];
105
-    m.coordinate{8}(5,:)=[-48 21 33];
106
-    m.coordinate{8}(6,:)=[42 33 36];
107
-    m.coordinate{8}(7,:)=[-3 -6 57];
108
-    m.coordinate{8}(8,:)=[-39 -48 45];
109 140
     m = class(m,'SubjectRoiMapping');
110 141
     
111 142
 elseif isa(argv,'SubjectRoiMapping') % copy
... ...
@@ -21,6 +21,7 @@ globalEnd       = inputStruct.psthEnd;
21 21
 baselineStart   = inputStruct.baselineStart;
22 22
 baselineEnd     = inputStruct.baselineEnd;
23 23
 eventList       = inputStruct.eventList;
24
+labelMap        = inputStruct.labelMap;
24 25
 
25 26
 
26 27
 minPerformance = inf;
... ...
@@ -53,11 +54,11 @@ maxPerformance = -inf;
53 54
             
54 55
             tmp =[];
55 56
             anyvoxel = 1;
56
-            for label = 1:size(pst{1,anyvoxel},2) 
57
-                for dp = 1:size(pst{1,anyvoxel}{1,label},1) % data point
58
-                row = label;
57
+            for pstConditionGroup = 1:size(pst{1,anyvoxel},2) 
58
+                for dp = 1:size(pst{1,anyvoxel}{1,pstConditionGroup},1) % data point
59
+                  row = getSVMLabel(labelMap,eventList(pstConditionGroup,1)) 
59 60
                     for voxel = 1:size(pst,2)
60
-                        row = [row, pst{1,voxel}{1,label}(dp,frameStart:frameEnd)]; % label,value,value
61
+                        row = [row, pst{1,voxel}{1,pstConditionGroup}(dp,frameStart:frameEnd)]; % label,value,value
61 62
                     end
62 63
                 tmp  = [tmp; row];
63 64
                 end
... ...
@@ -1,24 +1,17 @@
1 1
 function classify(varargin)
2 2
 
3
-PROJECT_BASE_PATH = 'D:\Analyze\Stimolos';
4
-PROJECT_RESULT_PATH = 'results\SPM.mat';
3
+
5 4
 
6 5
 switch nargin
7 6
     case 1
8
-        action = 'decode';
9 7
         paramModel = varargin{1};
8
+        % PROJECT_BASE_PATH = 'D:\Analyze\Stimolos';
9
+        PROJECT_BASE_PATH = 'D:\Analyze\Choice\24pilot';
10
+        PROJECT_RESULT_PATH = 'results\SPM.mat';
10 11
     otherwise
11 12
         error('spmtoolbox:SVMCrossVal:arginError','Please Specify action and parameter model');
12 13
 end
13 14
 
14
-    
15
-
16
-    switch(action)
17
-    case 'clear'
18
-        evalin('base','clear map lm SPM classList dataTimeLine decodeTable labelTimeLine svmopts trialProtocol voxelList xTimeEnd xTimeStart xTimeWindow');
19
-      
20
-    case 'decode'
21
-        
22 15
         
23 16
         % common params
24 17
         calculateParams  = struct;
... ...
@@ -37,13 +30,14 @@ end
37 30
 
38 31
         classStruct = parseClassDef(paramModel);
39 32
         
40
-        calculateParams.classList       = classStruct.label; %{'<','>'};
41
-        calculateParams.labelMap        = LabelMap(classStruct.label , classStruct.value); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4});
42
-        calculateParams.eventList       = classStruct.event; %[9,11,13; 10,12,14];
43
-
44
-        params = struct;
45
-        params.nClasses = 2;
46 33
         
34
+        calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
35
+        calculateParams.classList       = getClasses(calculateParams.labelMap);
36
+        calculateParams.eventList       = classStruct.eventMatrix; %[9,11,13; 10,12,14];
37
+%         calculateParams.eventList       = getPSTEventMatrix(calculateParams.labelMap);
38
+        
39
+%         params = struct;
40
+%         params.nClasses = 2;
47 41
         
48 42
         subjectSelection = getSubjectIDString(paramModel);
49 43
         decode = struct;
... ...
@@ -52,14 +46,14 @@ end
52 46
         
53 47
         for subjectCell = subjectSelection
54 48
             SubjectID = cell2mat(subjectCell);
49
+            namehelper = strcat('s',SubjectID); %Vars can not start with numbers.
55 50
 
56
-            display('loading SPM.mat');
51
+            display('loading SPM.mat ...');
57 52
             spm = load(fullfile(PROJECT_BASE_PATH,SubjectID,PROJECT_RESULT_PATH));
58
-%             display('done.');
53
+            display('... done.');
59 54
 
60 55
             %% calculate
61
-            display(sprintf('calculating cross-validation performance time-shift for Subject %s',SubjectID));
62
-            namehelper = strcat('s',SubjectID);
56
+            display(sprintf('calculating cross-validation performance time-shift for Subject %s. Please Wait. ...',SubjectID));
63 57
             calculateParams.(namehelper).des             = spm.SPM;
64 58
             calculateParams.(namehelper).voxelList       = parseVoxelList(paramModel,SubjectID);
65 59
             
... ...
@@ -68,8 +62,9 @@ end
68 62
     %         [decodeTable rawTimeCourse] = calculateDecodePerformance(spm,params.frameShiftStart,params.frameShiftEnd,params.xTimeWindow,params.svmopts,1:4,params.sessionList,params.voxelList,params.classList,params.labelMap,params.normalize);
69 63
             display('switching off all warnings');
70 64
             warning_state = warning('off','all');
71
-            
65
+            display('calculating ...');
72 66
             decode.(namehelper) = calculateDecodePerformance(calculateParams,SubjectID);
67
+            display('... done');
73 68
             display('restoring warnings');
74 69
             warning(warning_state);
75 70
             
... ...
@@ -108,9 +103,6 @@ end
108 103
 %         plotDecodePerformance(params.psthStart,params.psthEnd,params.nClasses,decode.decodeTable,params.frameShiftStart,params.frameShiftEnd,decode.rawTimeCourse);
109 104
         plotDecodePerformance(plotParams);
110 105
             
111
-        display('done.');
106
+        display('all done.');
112 107
 
113
-    otherwise
114
-        display('give action command: clear, decode');
115
-    end
116 108
     end
117 109
\ No newline at end of file
... ...
@@ -6,15 +6,16 @@ txt = get(model.txtClassDef,'String');
6 6
 
7 7
 nClasses = size(txt,1); % clear empty lines!
8 8
 
9
-outstruct.event = [];
9
+outstruct.eventMatrix = [];
10 10
 
11 11
 for i = 1:nClasses
12 12
     line = txt(i,:);
13 13
     delim = strfind(line,','); %first and last are real delimiter
14 14
 
15
-    outstruct.label{i} = strtrunc(line(1:delim(1)-1));
16
-    outstruct.event    = [outstruct.event ; eval(strtrunc(line(delim(1)+1:delim(length(delim))-1)))];
17
-    outstruct.value{i} = strtrunc(line(delim(length(delim))+1:length(line)));
15
+    outstruct.labelCells{i} = strtrunc(line(1:delim(1)-1));
16
+    outstruct.conditionCells{i} = eval(strtrunc(line(delim(1)+1:delim(length(delim))-1)));
17
+    outstruct.eventMatrix   = [outstruct.eventMatrix ; outstruct.conditionCells{i}];
18
+    outstruct.valueCells{i} = strtrunc(line(delim(length(delim))+1:length(line)));
18 19
 end
19 20
 
20 21
 end
... ...
@@ -38,7 +38,7 @@ function spm_SVMCrossVal
38 38
                     'Position',[firstColumn firstRow 0.66*frameWidth controlElementHeight*6]);
39 39
     set(model.subjectSelector,'BackgroundColor','w');
40 40
     
41
-    model.txtSmoothed = createTextField(pSubject,[0.68*frameWidth firstRow  0.25*frameWidth controlElementHeight],'0');
41
+    model.txtSmoothed = createTextField(pSubject,[0.68*frameWidth firstRow  0.25*frameWidth controlElementHeight],'1');
42 42
 
43 43
     % PSTH
44 44
     firstColumn  = 5.00;