0001
0002
0003
0004
0005 clear
0006
0007 comp = 'wm';
0008 data = 'link14hz';
0009
0010
0011 doelec = 1;
0012
0013
0014
0015 if strmatch('scd14hz',data),
0016 titles.ylabel = '\muA/m^3';
0017 else
0018 titles.ylabel = '\muV';
0019 end
0020 titles.title = '';
0021 titles.xlabel = 'msec';
0022 titles.xalign = 'center';
0023 titles.xxpos = [];
0024 titles.xypos = [];
0025 titles.yalign = 'right';
0026 titles.yypos = [];
0027 titles.yxpos = -300;
0028
0029
0030 switch comp,
0031 case 'sa',
0032 exp = 'oac'; con = 'ouc'; dif = 'oac-ouc';
0033 case 'wm',
0034 exp = 'tac'; con = 'oac'; dif = 'tac-oac';
0035 case 'ea',
0036 exp = 'oat'; con = 'oac'; dif = 'oat-oac';
0037 case 'dt',
0038 exp = 'tud'; con = 'tuc'; dif = 'tud-tuc';
0039 end
0040
0041 plots_loaddata
0042
0043 if mkdir('elec_plots'),
0044 cd('elec_plots');
0045 if mkdir(comp),
0046 cd(comp);
0047 else
0048 msg = sprintf('Cannot create %s directory',comp);
0049 error(msg);
0050 end
0051 else
0052 error('Cannot create elec_plots directory');
0053 end
0054
0055
0056
0057
0058
0059
0060 expvolt = eval(CONT.expvolt);
0061 convolt = eval(CONT.convolt);
0062 CONTexpvolt = expvolt;
0063 CONTconvolt = convolt;
0064
0065 expvolt = eval(PTSD.expvolt);
0066 convolt = eval(PTSD.convolt);
0067 PTSDexpvolt = expvolt;
0068 PTSDconvolt = convolt;
0069
0070
0071
0072
0073 xmin = min(timeArray);
0074 xmax = max(timeArray);
0075
0076 CONT.erpmax = max([CONTexpvolt CONTconvolt]);
0077 CONT.erpmin = min([CONTexpvolt CONTconvolt]);
0078 CONT.ymax = ceil( max(CONT.erpmax));
0079 CONT.ymin = floor(min(CONT.erpmin));
0080
0081 PTSD.erpmax = max([PTSDexpvolt PTSDconvolt]);
0082 PTSD.erpmin = min([PTSDexpvolt PTSDconvolt]);
0083 PTSD.ymax = ceil( max(PTSD.erpmax));
0084 PTSD.ymin = floor(min(PTSD.erpmin));
0085
0086 ymin = min(CONT.ymin,PTSD.ymin);
0087 ymax = max(CONT.ymax,PTSD.ymax);
0088
0089 scale = [xmin,xmax,ymin,ymax];
0090
0091
0092
0093
0094 interval = [100 1];
0095
0096 F = eeg_plot(1,timeArray,CONTexpvolt,scale,interval,titles);
0097 file = strcat(exp,'_page_cont.png');
0098 saveas(F,file)
0099 close(F)
0100
0101 F = eeg_plot(1,timeArray,PTSDexpvolt,scale,interval,titles);
0102 file = strcat(exp,'_page_ptsd.png');
0103 saveas(F,file)
0104 close(F)
0105
0106 F = eeg_plot(1,timeArray,CONTconvolt,scale,interval,titles);
0107 file = strcat(con,'_page_cont.png');
0108 saveas(F,file)
0109 close(F)
0110
0111 F = eeg_plot(1,timeArray,PTSDconvolt,scale,interval,titles);
0112 file = strcat(con,'_page_ptsd.png');
0113 saveas(F,file)
0114 close(F)
0115
0116 interval = [200 1];
0117
0118 F = eeg_plot(0,timeArray,CONTexpvolt,scale,interval,titles);
0119 file = strcat(exp,'_column_cont.png');
0120 saveas(F,file)
0121 close(F)
0122
0123 F = eeg_plot(0,timeArray,PTSDexpvolt,scale,interval,titles);
0124 file = strcat(exp,'_column_ptsd.png');
0125 saveas(F,file)
0126 close(F)
0127
0128 F = eeg_plot(0,timeArray,CONTconvolt,scale,interval,titles);
0129 file = strcat(con,'_column_cont.png');
0130 saveas(F,file)
0131 close(F)
0132
0133 F = eeg_plot(0,timeArray,PTSDconvolt,scale,interval,titles);
0134 file = strcat(con,'_column_ptsd.png');
0135 saveas(F,file)
0136 close(F)
0137
0138
0139
0140
0141
0142
0143
0144
0145 CONTdifvolt = eval(CONT.difvolt);
0146
0147 PTSDdifvolt = eval(PTSD.difvolt);
0148
0149
0150
0151 xmin = min(timeArray);
0152 xmax = max(timeArray);
0153
0154 CONT.difmax = max(CONTdifvolt);
0155 CONT.difmin = min(CONTdifvolt);
0156 CONT.ymax = ceil( max(CONT.difmax));
0157 CONT.ymin = floor(min(CONT.difmin));
0158
0159 PTSD.difmax = max(PTSDdifvolt);
0160 PTSD.difmin = min(PTSDdifvolt);
0161 PTSD.ymax = ceil( max(PTSD.difmax));
0162 PTSD.ymin = floor(min(PTSD.difmin));
0163
0164 ymax = ceil( max([CONT.ymax PTSD.ymax]));
0165 ymin = floor(min([CONT.ymin PTSD.ymin]));
0166
0167 scale = [xmin,xmax,ymin,ymax];
0168
0169
0170
0171
0172 interval = [100 1];
0173
0174 F = eeg_plot(1,timeArray,CONTdifvolt,scale,interval,titles);
0175 file = strcat(comp,'_dif_page_cont.png');
0176 saveas(F,file)
0177 close(F)
0178
0179 F = eeg_plot(1,timeArray,PTSDdifvolt,scale,interval,titles);
0180 file = strcat(comp,'_dif_page_ptsd.png');
0181 saveas(F,file)
0182 close(F)
0183
0184 interval = [200 1];
0185
0186 F = eeg_plot(0,timeArray,CONTdifvolt,scale,interval,titles);
0187 file = strcat(comp,'_dif_column_cont.png');
0188 saveas(F,file)
0189 close(F)
0190
0191 F = eeg_plot(0,timeArray,PTSDdifvolt,scale,interval,titles);
0192 file = strcat(comp,'_dif_column_ptsd.png');
0193 saveas(F,file)
0194 close(F)
0195
0196
0197
0198
0199
0200
0201
0202
0203 if ~doelec, return; end
0204
0205
0206
0207
0208
0209
0210
0211
0212 for elec = 1:124,
0213
0214 expvolt = eval(CONT.expvolt);
0215 convolt = eval(CONT.convolt);
0216 CONT.erp(:,1) = expvolt(:,elec);
0217 CONT.erp(:,2) = convolt(:,elec);
0218
0219 expvolt = eval(PTSD.expvolt);
0220 convolt = eval(PTSD.convolt);
0221 PTSD.erp(:,1) = expvolt(:,elec);
0222 PTSD.erp(:,2) = convolt(:,elec);
0223
0224
0225
0226
0227 xmin = min(timeArray);
0228 xmax = max(timeArray);
0229
0230 CONT.erpmax = max(CONT.erp);
0231 CONT.erpmin = min(CONT.erp);
0232 CONT.ymax = ceil( max(CONT.erpmax));
0233 CONT.ymin = floor(min(CONT.erpmin));
0234
0235 PTSD.erpmax = max(PTSD.erp);
0236 PTSD.erpmin = min(PTSD.erp);
0237 PTSD.ymax = ceil( max(PTSD.erpmax));
0238 PTSD.ymin = floor(min(PTSD.erpmin));
0239
0240 ymin = min(CONT.ymin,PTSD.ymin);
0241 ymax = max(CONT.ymax,PTSD.ymax);
0242
0243 scale = [xmin,xmax,ymin,ymax];
0244
0245
0246
0247
0248 if mkdir('page'),
0249 cd('page');
0250 else
0251 error('Cannot create page directory');
0252 end
0253
0254 interval = [100 1];
0255
0256 F = eeg_plot(1,timeArray,CONT.erp,scale,interval,titles);
0257 file = strcat(comp,'_page_elec',sprintf('%03d',elec),'_cont.png');
0258 saveas(F,file)
0259 close(F)
0260
0261 F = eeg_plot(1,timeArray,PTSD.erp,scale,interval,titles);
0262 file = strcat(comp,'_page_elec',sprintf('%03d',elec),'_ptsd.png');
0263 saveas(F,file)
0264 close(F)
0265
0266 cd ..
0267 if mkdir('column'),
0268 cd('column');
0269 else
0270 error('Cannot create column directory');
0271 end
0272
0273 interval = [200 1];
0274
0275 F = eeg_plot(0,timeArray,CONT.erp,scale,interval,titles);
0276 file = strcat(comp,'_column_elec',sprintf('%03d',elec),'_cont.png');
0277 saveas(F,file)
0278 close(F)
0279
0280 F = eeg_plot(0,timeArray,PTSD.erp,scale,interval,titles);
0281 file = strcat(comp,'_column_elec',sprintf('%03d',elec),'_ptsd.png');
0282 saveas(F,file)
0283 close(F)
0284
0285 cd ..
0286
0287 end
0288
0289
0290
0291
0292
0293
0294 for elec = 1:124,
0295
0296 difvolt = eval(CONT.difvolt);
0297 erp(:,1) = difvolt(:,elec);
0298
0299 difvolt = eval(PTSD.difvolt);
0300 erp(:,2) = difvolt(:,elec);
0301
0302
0303
0304 xmin = min(timeArray);
0305 xmax = max(timeArray);
0306
0307 erpmax = max(erp);
0308 erpmin = min(erp);
0309 ymax = ceil( max(erpmax));
0310 ymin = floor(min(erpmin));
0311
0312 scale = [xmin,xmax,ymin,ymax];
0313
0314
0315
0316
0317 if mkdir('page'),
0318 cd('page');
0319 else
0320 error('Cannot create page directory');
0321 end
0322
0323 interval = [100 1];
0324
0325 F = eeg_plot(1,timeArray,erp,scale,interval,titles);
0326 file = strcat(comp,'_dif_page_elec',sprintf('%03d',elec),'.png');
0327 saveas(F,file)
0328 close(F)
0329
0330 cd ..
0331 if mkdir('column'),
0332 cd('column');
0333 else
0334 error('Cannot create column directory');
0335 end
0336
0337 interval = [200 1];
0338
0339 F = eeg_plot(0,timeArray,erp,scale,interval,titles);
0340 file = strcat(comp,'_dif_column_elec',sprintf('%03d',elec),'.png');
0341 saveas(F,file)
0342 close(F)
0343
0344 cd ..
0345
0346 end
0347
0348
0349
0350 return