wolffd@0
|
1 function res = displot(x,y,xlab,ylab,t,fp,pp,tp,tv,ch,multidata,pm,ap,rp,cl)
|
wolffd@0
|
2 % graphical display of any data (except mirscalar data) computed by MIRToolbox
|
wolffd@0
|
3
|
wolffd@0
|
4 %opengl('OpenGLWobbleTesselatorBug',1)
|
wolffd@0
|
5 % Rendering complex patch object may cause segmentation violation and
|
wolffd@0
|
6 % return a tesselator error message in the stack trace. This command
|
wolffd@0
|
7 % enables a workaround of that bug that might work sometimes...
|
wolffd@0
|
8
|
wolffd@0
|
9 if isempty(y)
|
wolffd@0
|
10 res = 0;
|
wolffd@0
|
11 return
|
wolffd@0
|
12 end
|
wolffd@0
|
13 manychannels = 0;
|
wolffd@0
|
14 y1 = y{1};
|
wolffd@0
|
15 if length(y) == 1
|
wolffd@0
|
16 y = y{1};
|
wolffd@0
|
17 if length(x) == 1
|
wolffd@0
|
18 x = x{1};
|
wolffd@0
|
19 end
|
wolffd@0
|
20 end
|
wolffd@0
|
21 if isempty(y)
|
wolffd@0
|
22 res = 0;
|
wolffd@0
|
23 return
|
wolffd@0
|
24 end
|
wolffd@0
|
25
|
wolffd@0
|
26 if isstruct(cl)
|
wolffd@0
|
27 y = cl.centr(:,cl.index);
|
wolffd@0
|
28 end
|
wolffd@0
|
29
|
wolffd@0
|
30 figure
|
wolffd@0
|
31 fp2 = uncell(fp);
|
wolffd@0
|
32 c = size(y,2);
|
wolffd@0
|
33 lx = size(y,1);
|
wolffd@0
|
34 l = size(y1,3); % Number of channels
|
wolffd@0
|
35 il = (1-0.15)/l;
|
wolffd@0
|
36
|
wolffd@0
|
37 if iscell(y)
|
wolffd@0
|
38 if size(y{1},3) > 1 && size(y{1},1) == 1
|
wolffd@0
|
39 for j = 1:c
|
wolffd@0
|
40 y{j} = reshape(y{j},size(y{j},2),size(y{j},3));
|
wolffd@0
|
41 y{j} = y{j}';
|
wolffd@0
|
42 end
|
wolffd@0
|
43 lx = l;
|
wolffd@0
|
44 l = 1;
|
wolffd@0
|
45 end
|
wolffd@0
|
46 else
|
wolffd@0
|
47 if l > 1 && lx == 1
|
wolffd@0
|
48 y = reshape(y,size(y,2),size(y,3));
|
wolffd@0
|
49 y = y';
|
wolffd@0
|
50 x = repmat(ch,[1 size(y,2) size(y,3)]);
|
wolffd@0
|
51 lx = l;
|
wolffd@0
|
52 l = 1;
|
wolffd@0
|
53 end
|
wolffd@0
|
54 end
|
wolffd@0
|
55 if not(iscell(y)) && l > 20 %&& size(y,3) == 1
|
wolffd@0
|
56 manychannels = 1;
|
wolffd@0
|
57 if lx == 1
|
wolffd@0
|
58 y = reshape(y,[c l])';
|
wolffd@0
|
59 lx = l;
|
wolffd@0
|
60 l = 1;
|
wolffd@0
|
61 else
|
wolffd@0
|
62 y = reshape(y,[lx l])';
|
wolffd@0
|
63 fp = reshape(x,[1 lx size(x,3)]);
|
wolffd@0
|
64 fp = fp(:,:,1);
|
wolffd@0
|
65 fp2 = fp;
|
wolffd@0
|
66 c = l;
|
wolffd@0
|
67 l = 1;
|
wolffd@0
|
68 x = ch';
|
wolffd@0
|
69 end
|
wolffd@0
|
70 end
|
wolffd@0
|
71 curve = (not(iscell(y)) && not(isequal(fp2,0)) && size(fp2,2)==1) || ...
|
wolffd@0
|
72 ...%(iscell(y) && size(y{1}) == 1) || ...
|
wolffd@0
|
73 c == 1 || (strcmp(xlab,'time (s)') && not(manychannels));
|
wolffd@0
|
74 if curve
|
wolffd@0
|
75 for i = 1:l
|
wolffd@0
|
76 if l>1
|
wolffd@0
|
77 subplot(l,1,l-i+1,'align');
|
wolffd@0
|
78 end
|
wolffd@0
|
79 if not(iscell(y))
|
wolffd@0
|
80 y = {y};
|
wolffd@0
|
81 x = {x};
|
wolffd@0
|
82 end
|
wolffd@0
|
83 col = cell(length(y));
|
wolffd@0
|
84 for h = 1:length(y)
|
wolffd@0
|
85 col{h} = zeros(size(y{h},2),3,size(y{h},4));
|
wolffd@0
|
86 for j = 1:size(y{h},2)
|
wolffd@0
|
87 if ischar(x{h})
|
wolffd@0
|
88 xj = x{h};
|
wolffd@0
|
89 else
|
wolffd@0
|
90 xj = x{h}(:,j);
|
wolffd@0
|
91 end
|
wolffd@0
|
92 yj = y{h}(:,j,i,:);
|
wolffd@0
|
93 lk = size(yj,4);
|
wolffd@0
|
94 for k = 1:lk
|
wolffd@0
|
95 if c > 1
|
wolffd@0
|
96 col{h}(j,:,k) = rand(1,3);
|
wolffd@0
|
97 else
|
wolffd@0
|
98 col{h}(j,:,k) = num2col(k);
|
wolffd@0
|
99 end
|
wolffd@0
|
100 yk = yj(:,:,:,k);
|
wolffd@0
|
101 if not(isempty(yk))
|
wolffd@0
|
102 if iscell(xj)
|
wolffd@0
|
103 lj = length(xj);
|
wolffd@0
|
104 abs = 0:lj-1;
|
wolffd@0
|
105 elseif ischar(xj)
|
wolffd@0
|
106 abs = 1:length(yk);
|
wolffd@0
|
107 else
|
wolffd@0
|
108 abs = xj;
|
wolffd@0
|
109 end
|
wolffd@0
|
110 if length(abs) < 20 && lk == 1 && c == 1
|
wolffd@0
|
111 bar(abs,yk);
|
wolffd@0
|
112 else
|
wolffd@0
|
113 plot(abs,yk,'Color',col{h}(j,:,k));
|
wolffd@0
|
114 end
|
wolffd@0
|
115 if iscell(xj)
|
wolffd@0
|
116 tick = 0:ceil(lj/14):lj-1;
|
wolffd@0
|
117 set(gca,'xtick',tick);
|
wolffd@0
|
118 set(gca,'xticklabel',xj(tick+1));
|
wolffd@0
|
119 elseif ischar(xj)
|
wolffd@0
|
120 set(gca,'xticklabel',x);
|
wolffd@0
|
121 end
|
wolffd@0
|
122 hold on
|
wolffd@0
|
123 end
|
wolffd@0
|
124 end
|
wolffd@0
|
125 end
|
wolffd@0
|
126 if length(y) > 1
|
wolffd@0
|
127 if isempty(cl)% || isempty(cl{1}) ... this because of a bug..
|
wolffd@0
|
128 %|| isempty(cl{i})
|
wolffd@0
|
129 colr = h;
|
wolffd@0
|
130 %elseif iscell(cl{i})
|
wolffd@0
|
131 % colr = cl{i}(h);
|
wolffd@0
|
132 elseif length(cl) == 1
|
wolffd@0
|
133 colr = cl;
|
wolffd@0
|
134 else
|
wolffd@0
|
135 colr = cl(h); %cl{i}(h);
|
wolffd@0
|
136 end
|
wolffd@0
|
137 if not(isempty(x{h}))
|
wolffd@0
|
138 rectangle('Position',[x{h}(1),...
|
wolffd@0
|
139 min(min(y{h}(:,:,i))),...
|
wolffd@0
|
140 x{h}(end)-x{h}(1),...
|
wolffd@0
|
141 max(max(y{h}(:,:,i)))-...
|
wolffd@0
|
142 min(min(y{h}(:,:,i)))]+1e-16,...
|
wolffd@0
|
143 'EdgeColor',num2col(colr),'Curvature',.1,'LineWidth',1)
|
wolffd@0
|
144 end
|
wolffd@0
|
145 end
|
wolffd@0
|
146 end
|
wolffd@0
|
147 if not(isempty(multidata))
|
wolffd@0
|
148 legend(multidata{:},'Location','Best')
|
wolffd@0
|
149 end
|
wolffd@0
|
150 for h = 1:length(y)
|
wolffd@0
|
151 for j = 1:size(y{h},2)
|
wolffd@0
|
152 xj = x{h}(:,j);
|
wolffd@0
|
153 yj = y{h}(:,j,i,:);
|
wolffd@0
|
154 lk = size(yj,4);
|
wolffd@0
|
155 for k = 1:lk
|
wolffd@0
|
156 yk = yj(:,:,:,k);
|
wolffd@0
|
157 if not(isempty(yk))
|
wolffd@0
|
158 if size(y{h},2) > 1
|
wolffd@0
|
159 rectangle('Position',[xj(1),min(yk),...
|
wolffd@0
|
160 xj(end)-xj(1),max(yk)-min(yk)]+1e-16,...
|
wolffd@0
|
161 'EdgeColor',col{h}(j,:,k))
|
wolffd@0
|
162 end
|
wolffd@0
|
163 if not(isempty(pp)) && not(isempty(pp{1}))
|
wolffd@0
|
164 [ppj order] = sort(pp{h}{1,j,i});
|
wolffd@0
|
165 if not(isempty(pm)) && not(isempty(pm{1}))
|
wolffd@0
|
166 pmj = pm{h}{1,j,i}(order);
|
wolffd@0
|
167 [R C] = find(pmj==k);
|
wolffd@0
|
168 if iscell(xj)
|
wolffd@0
|
169 plot(ppj(R,C)-1,yk(ppj(R,C)),'or')
|
wolffd@0
|
170 else
|
wolffd@0
|
171 plot(xj(ppj(R,C)),yk(ppj(R,C)),'or')
|
wolffd@0
|
172 end
|
wolffd@0
|
173 else
|
wolffd@0
|
174 if lk > 1
|
wolffd@0
|
175 [R C] = find(ppj(:,:,2)==k);
|
wolffd@0
|
176 plot(xj(ppj(R,C)),yk(ppj(R,C)),'or')
|
wolffd@0
|
177 else
|
wolffd@0
|
178 plot(xj(ppj),yk(ppj),'or')
|
wolffd@0
|
179 end
|
wolffd@0
|
180 end
|
wolffd@0
|
181 if not(isempty(ap)) && not(isempty(ap{1}))
|
wolffd@0
|
182 apj = ap{h}{1,j,i};
|
wolffd@0
|
183 plot(xj(apj),yk(apj),'dr')
|
wolffd@0
|
184 for g = 1:length(apj)
|
wolffd@0
|
185 line([xj(ppj(g)),xj(apj(g))],...
|
wolffd@0
|
186 [yk(ppj(g)),yk(apj(g))],...
|
wolffd@0
|
187 'Color','r')
|
wolffd@0
|
188 end
|
wolffd@0
|
189 end
|
wolffd@0
|
190 if not(isempty(rp)) && not(isempty(rp{1}))
|
wolffd@0
|
191 rpj = rp{h}{1,j,i};
|
wolffd@0
|
192 plot(xj(rpj),yk(rpj),'dr')
|
wolffd@0
|
193 for g = 1:length(rpj)
|
wolffd@0
|
194 line([xj(ppj(g)),xj(rpj(g))],...
|
wolffd@0
|
195 [yk(ppj(g)),yk(rpj(g))],...
|
wolffd@0
|
196 'Color','r')
|
wolffd@0
|
197 end
|
wolffd@0
|
198 end
|
wolffd@0
|
199 end
|
wolffd@0
|
200 end
|
wolffd@0
|
201 end
|
wolffd@0
|
202 end
|
wolffd@0
|
203 end
|
wolffd@0
|
204 if i == l
|
wolffd@0
|
205 title(t)
|
wolffd@0
|
206 end
|
wolffd@0
|
207 if i == 1
|
wolffd@0
|
208 xlabel(xlab)
|
wolffd@0
|
209 end
|
wolffd@0
|
210 if l > 1
|
wolffd@0
|
211 %if iscell(x)
|
wolffd@0
|
212 % num = x{i}(1);
|
wolffd@0
|
213 %else
|
wolffd@0
|
214 num = ch(i);
|
wolffd@0
|
215 %end
|
wolffd@0
|
216 pos = get(gca,'Position');
|
wolffd@0
|
217 axes('Position',[pos(1)-.05 pos(2)+pos(4)/2 .01 .01],'Visible','off');
|
wolffd@0
|
218 text(0,0,num2str(num),'FontSize',12,'Color','r')
|
wolffd@0
|
219 end
|
wolffd@0
|
220 end
|
wolffd@0
|
221 else
|
wolffd@0
|
222 % 2-dimensional image
|
wolffd@0
|
223 displayseg = 0;
|
wolffd@0
|
224 if iscell(x) && ischar(x{1})
|
wolffd@0
|
225 if size(y,4) > 1 || size(y,1) > size(x,1)
|
wolffd@0
|
226 ticky = 0.5:23.5;
|
wolffd@0
|
227 tickylab = {'CM','C#M','DM','D#M','EM','FM','F#M',...
|
wolffd@0
|
228 'GM','G#M','AM','A#M','BM','Cm','C#m','Dm','D#m','Em',...
|
wolffd@0
|
229 'Fm','F#m','Gm','G#m','Am','A#m','Bm'};
|
wolffd@0
|
230 else
|
wolffd@0
|
231 ticky = (1:size(x,1))';
|
wolffd@0
|
232 tickylab = x;
|
wolffd@0
|
233 displayseg = 1;
|
wolffd@0
|
234 end
|
wolffd@0
|
235 x = (1:size(y,1))';
|
wolffd@0
|
236 elseif iscell(x) && iscell(x{1}) && ischar(x{1}{1})
|
wolffd@0
|
237 if size(y{1},4) > 1
|
wolffd@0
|
238 ticky = 0.5:23.5;
|
wolffd@0
|
239 tickylab = {'CM','C#M','DM','D#M','EM','FM','F#M',...
|
wolffd@0
|
240 'GM','G#M','AM','A#M','BM','Cm','C#m','Dm','D#m','Em',...
|
wolffd@0
|
241 'Fm','F#m','Gm','G#m','Am','A#m','Bm'};
|
wolffd@0
|
242 else
|
wolffd@0
|
243 ticky = (1:size(x{1},1))';
|
wolffd@0
|
244 tickylab = x{1};
|
wolffd@0
|
245 displayseg = 1;
|
wolffd@0
|
246 end
|
wolffd@0
|
247 for i = 1:length(x)
|
wolffd@0
|
248 x{i} = (1:size(x{i},1))';
|
wolffd@0
|
249 end
|
wolffd@0
|
250 else
|
wolffd@0
|
251 ticky = [];
|
wolffd@0
|
252 end
|
wolffd@0
|
253 if iscell(y)
|
wolffd@0
|
254 displayseg = 1;
|
wolffd@0
|
255 for i = 1:l
|
wolffd@0
|
256 if l>1
|
wolffd@0
|
257 subplot(l,1,l-i+1,'align');
|
wolffd@0
|
258 % subplot('Position',[0.1 (i-1)*il+0.1 0.89 il-0.02])
|
wolffd@0
|
259 end
|
wolffd@0
|
260 hold on
|
wolffd@0
|
261 %surfplot(segt,x{1},repmat(x{1}/x{1}(end)*.1,[1,length(segt)]));
|
wolffd@0
|
262 if length(x)==1 && length(y)>1
|
wolffd@0
|
263 for k = 2:length(y)
|
wolffd@0
|
264 x{k} = x{1};
|
wolffd@0
|
265 end
|
wolffd@0
|
266 end
|
wolffd@0
|
267 for j = 1:length(x)
|
wolffd@0
|
268 if length(x{j}) > 1
|
wolffd@0
|
269 if size(x{j},1) == 1 && size(x{j},3) > 1
|
wolffd@0
|
270 x{j} = reshape(x{j},size(x{j},2),size(x{j},3))';
|
wolffd@0
|
271 mel = 1;
|
wolffd@0
|
272 else
|
wolffd@0
|
273 mel = 0;
|
wolffd@0
|
274 end
|
wolffd@0
|
275 xx = zeros(size(x{j},1)*size(y{j},4),1); %,size(x{j},2));
|
wolffd@0
|
276 yy = zeros(size(y{j},1)*size(y{j},4),size(y{j},2));
|
wolffd@0
|
277 for k = 1:size(y{j},4)
|
wolffd@0
|
278 xx((k-1)*size(x{j},1)+1:k*size(x{j},1),1) = x{j}(:,1);
|
wolffd@0
|
279 yy((k-1)*size(y{j},1)+1:k*size(y{j},1),:) = y{j}(:,:,i,k);
|
wolffd@0
|
280 end
|
wolffd@0
|
281 if size(y{j},4) == 1 && not(mel)
|
wolffd@0
|
282 xxx = [1.5*xx(1,1)-0.5*xx(2,1);...
|
wolffd@0
|
283 (xx(1:end-1)+xx(2:end))/2;...
|
wolffd@0
|
284 1.5*xx(end,1)-0.5*xx(end-1,1)];
|
wolffd@0
|
285 else
|
wolffd@0
|
286 xxx = (0:size(yy,1))';
|
wolffd@0
|
287 end
|
wolffd@0
|
288 if size(fp{j},2) > 1
|
wolffd@0
|
289 segt = [fp{j}(1,1),...
|
wolffd@0
|
290 mean([fp{j}(2,1:end-1);fp{j}(1,2:end)]),...
|
wolffd@0
|
291 fp{j}(2,end)];
|
wolffd@0
|
292 else
|
wolffd@0
|
293 segt = fp{j}';
|
wolffd@0
|
294 end
|
wolffd@0
|
295 surfplot(segt,xxx,yy(:,:));
|
wolffd@0
|
296 if not(isempty(ticky))
|
wolffd@0
|
297 set(gca,'ytick',ticky);
|
wolffd@0
|
298 set(gca,'yticklabel',tickylab);
|
wolffd@0
|
299 end
|
wolffd@0
|
300 set(gca,'YDir','normal')
|
wolffd@0
|
301 if (exist('pp') == 1) && not(isempty(pp))
|
wolffd@0
|
302 if not(isempty(pp{j}))
|
wolffd@0
|
303 for k = 1:length(pp{j})
|
wolffd@0
|
304 ppj = pp{j}{k};
|
wolffd@0
|
305 if size(ppj,3) == 2
|
wolffd@0
|
306 ppj(:,:,1) = ppj(:,:,1) + (ppj(:,:,2)-1)*size(x,1);
|
wolffd@0
|
307 ppj(:,:,2) = [];
|
wolffd@0
|
308 plot(mean(fp{j}(:,k)),ppj-.5,'+w')
|
wolffd@0
|
309 elseif 0 %(exist('pm') == 1) && not(isempty(pm))
|
wolffd@0
|
310 pmj = pm{k}{1,1,i};
|
wolffd@0
|
311 ppj(:,:) = ppj(:,:) + (pmj(:,:)-1)*size(x,1);
|
wolffd@0
|
312 plot(mean(fp{j}(:,k)),ppj-.5,'+w') % fp shows segmentation points
|
wolffd@0
|
313 elseif not(isempty(ppj))
|
wolffd@0
|
314 plot(mean(fp{j}(:,k)),xx(ppj),'+k')
|
wolffd@0
|
315 end
|
wolffd@0
|
316 end
|
wolffd@0
|
317 end
|
wolffd@0
|
318 end
|
wolffd@0
|
319 end
|
wolffd@0
|
320 end
|
wolffd@0
|
321 if i == l
|
wolffd@0
|
322 title(t)
|
wolffd@0
|
323 end
|
wolffd@0
|
324 if i == 1
|
wolffd@0
|
325 if manychannels
|
wolffd@0
|
326 xlabel(xlab);
|
wolffd@0
|
327 elseif displayseg
|
wolffd@0
|
328 xlabel('time axis (in s.)');
|
wolffd@0
|
329 else
|
wolffd@0
|
330 xlabel('temporal location of beginning of frame (in s.)');
|
wolffd@0
|
331 end
|
wolffd@0
|
332 end
|
wolffd@0
|
333 if l > 1
|
wolffd@0
|
334 num = ch(i);
|
wolffd@0
|
335 pos = get(gca,'Position');
|
wolffd@0
|
336 axes('Position',[pos(1)-.05 pos(2)+pos(4)/2 .01 .01],'Visible','off');
|
wolffd@0
|
337 text(0,0,num2str(num),'FontSize',12,'Color','r')
|
wolffd@0
|
338 end
|
wolffd@0
|
339 end
|
wolffd@0
|
340 y = y{1};
|
wolffd@0
|
341 else
|
wolffd@0
|
342 mel = 0;
|
wolffd@0
|
343 if iscell(x)
|
wolffd@0
|
344 x = x{1};
|
wolffd@0
|
345 end
|
wolffd@0
|
346 if size(x,1) == 1 && size(y,1) > 1
|
wolffd@0
|
347 if size(x,3) == 1
|
wolffd@0
|
348 x = x';
|
wolffd@0
|
349 else
|
wolffd@0
|
350 mel = 1;
|
wolffd@0
|
351 end
|
wolffd@0
|
352 end
|
wolffd@0
|
353 if not(isempty(pp)) && iscell(pp{1})
|
wolffd@0
|
354 pp = pp{1};
|
wolffd@0
|
355 pm = pm{1};
|
wolffd@0
|
356 end
|
wolffd@0
|
357 for i = 1:l
|
wolffd@0
|
358 if l>1
|
wolffd@0
|
359 subplot('Position',[0.1 (i-1)*il+0.1 0.89 il-0.02])
|
wolffd@0
|
360 end
|
wolffd@0
|
361 xx = zeros(size(x,1)*size(y,4),1); %,size(x,2));
|
wolffd@0
|
362 yy = zeros(size(y,1)*size(y,4),size(y,2));
|
wolffd@0
|
363 for k = 1:size(y,4)
|
wolffd@0
|
364 xx((k-1)*size(x,1)+1:k*size(x,1),1) = x(:,1);
|
wolffd@0
|
365 yy((k-1)*size(y,1)+1:k*size(y,1),:) = y(:,:,i,k);
|
wolffd@0
|
366 end
|
wolffd@0
|
367 if iscell(fp)
|
wolffd@0
|
368 fp = uncell(fp);
|
wolffd@0
|
369 end
|
wolffd@0
|
370 lx = length(xx);
|
wolffd@0
|
371 if lx < 6
|
wolffd@0
|
372 curve = 1;
|
wolffd@0
|
373 ttt = (fp(1,:)+fp(2,:))/2;
|
wolffd@0
|
374 plot(ttt,yy)
|
wolffd@0
|
375 if i == 1
|
wolffd@0
|
376 legdata = cell(1,lx);
|
wolffd@0
|
377 if strcmp(xlab(end),'s')
|
wolffd@0
|
378 xlab(end) = [];
|
wolffd@0
|
379 end
|
wolffd@0
|
380 for j = 1:lx
|
wolffd@0
|
381 legdata{j} = [xlab,' ',num2str(j)];
|
wolffd@0
|
382 end
|
wolffd@0
|
383 legend(legdata)
|
wolffd@0
|
384 end
|
wolffd@0
|
385 else
|
wolffd@0
|
386 ttt = [fp(1,:) 2*fp(1,end)-fp(1,end-1)];
|
wolffd@0
|
387 if size(y,4) == 1 && not(mel)
|
wolffd@0
|
388 xxx = [1.5*xx(1)-0.5*xx(2);...
|
wolffd@0
|
389 (xx(1:end-1)+xx(2:end))/2;...
|
wolffd@0
|
390 1.5*xx(end)-0.5*xx(end-1)];
|
wolffd@0
|
391 else
|
wolffd@0
|
392 xxx = (0:size(yy,1))';
|
wolffd@0
|
393 end
|
wolffd@0
|
394 surfplot(ttt,xxx,yy);
|
wolffd@0
|
395 if not(isempty(ticky))
|
wolffd@0
|
396 set(gca,'ytick',ticky);
|
wolffd@0
|
397 set(gca,'yticklabel',tickylab);
|
wolffd@0
|
398 end
|
wolffd@0
|
399 set(gca,'YDir','normal');
|
wolffd@0
|
400 end
|
wolffd@0
|
401 hold on
|
wolffd@0
|
402 %if iscell(pp)
|
wolffd@0
|
403 % pp = uncell(pp);
|
wolffd@0
|
404 % if iscell(pm)
|
wolffd@0
|
405 % pm = uncell(pm);
|
wolffd@0
|
406 % end
|
wolffd@0
|
407 %end
|
wolffd@0
|
408 if (exist('tp') == 1) && not(isempty(tp))
|
wolffd@0
|
409 tp = tp{i}{1};
|
wolffd@0
|
410 tv = tv{i}{1};
|
wolffd@0
|
411 for k = 1:size(tp,1)
|
wolffd@0
|
412 prej = 0;
|
wolffd@0
|
413 for j = 1:size(tp,2)
|
wolffd@0
|
414 if tv(k,j)
|
wolffd@0
|
415 if prej% && not(isempty(tp(k,j)))
|
wolffd@0
|
416 plot([(ttt(prej)+ttt(prej+1))/2,...
|
wolffd@0
|
417 (ttt(j)+ttt(j+1))/2],...
|
wolffd@0
|
418 [(xxx(tp(k,prej))+xxx(tp(k,prej)+1))/2,...
|
wolffd@0
|
419 (xxx(tp(k,j))+xxx(tp(k,j)+1))/2],...
|
wolffd@0
|
420 'k','LineWidth',1)
|
wolffd@0
|
421 plot([(ttt(prej)+ttt(prej+1))/2,...
|
wolffd@0
|
422 (ttt(j)+ttt(j+1))/2],...
|
wolffd@0
|
423 [(xxx(tp(k,prej))+xxx(tp(k,prej)+1))/2,...
|
wolffd@0
|
424 (xxx(tp(k,j))+xxx(tp(k,j)+1))/2],...
|
wolffd@0
|
425 'w+','MarkerSize',10)
|
wolffd@0
|
426 plot([(ttt(prej)+ttt(prej+1))/2,...
|
wolffd@0
|
427 (ttt(j)+ttt(j+1))/2],...
|
wolffd@0
|
428 [(xxx(tp(k,prej))+xxx(tp(k,prej)+1))/2,...
|
wolffd@0
|
429 (xxx(tp(k,j))+xxx(tp(k,j)+1))/2],...
|
wolffd@0
|
430 'kx','MarkerSize',10)
|
wolffd@0
|
431 end
|
wolffd@0
|
432 prej = j;
|
wolffd@0
|
433 end
|
wolffd@0
|
434 end
|
wolffd@0
|
435 end
|
wolffd@0
|
436 elseif (exist('pp') == 1) && not(isempty(pp))
|
wolffd@0
|
437 if size(pp,3) == l
|
wolffd@0
|
438 for j = 1:size(pp,2)
|
wolffd@0
|
439 ppj = pp{1,j,i};
|
wolffd@0
|
440 if (exist('pm') == 1)
|
wolffd@0
|
441 pmj = pm{1,j,i};
|
wolffd@0
|
442 else
|
wolffd@0
|
443 pmj = [];
|
wolffd@0
|
444 end
|
wolffd@0
|
445 if iscell(ppj)
|
wolffd@0
|
446 ppj = uncell(ppj);
|
wolffd@0
|
447 if iscell(pmj)
|
wolffd@0
|
448 pmj = uncell(pmj);
|
wolffd@0
|
449 end
|
wolffd@0
|
450 end
|
wolffd@0
|
451 if size(ppj,3) == 2
|
wolffd@0
|
452 ppj(:,:,1) = ppj(:,:,1) + (ppj(:,:,2)-1)*size(x,1);
|
wolffd@0
|
453 ppj(:,:,2) = [];
|
wolffd@0
|
454 %plot((fp(1,j)+fp(2,j))/2,ppj-.5,'+w')
|
wolffd@0
|
455 plot((ttt(j)+ttt(j+1))/2,(xxx(ppj)+xxx(ppj+1))/2,'+w')
|
wolffd@0
|
456 else
|
wolffd@0
|
457 if not(isempty(pmj))
|
wolffd@0
|
458 ppj(:,:,:) = ppj(:,:,:) + (pmj(:,:,:)-1)*size(x,1);
|
wolffd@0
|
459 end
|
wolffd@0
|
460 if not(isempty(ppj))
|
wolffd@0
|
461 %plot((segt(j)+segt(j+1))/2,xx(ppj),'+k','MarkerSize',10)
|
wolffd@0
|
462 plot((ttt(j)+ttt(j+1))/2,(xxx(ppj)+xxx(ppj+1))/2,'+w','MarkerSize',10)
|
wolffd@0
|
463 end
|
wolffd@0
|
464 end
|
wolffd@0
|
465 end
|
wolffd@0
|
466 else
|
wolffd@0
|
467 for j = 1:size(pp,3)
|
wolffd@0
|
468 ppj = pp{1,1,j};
|
wolffd@0
|
469 if (exist('pm') == 1)
|
wolffd@0
|
470 pmj = pm{1,1,j};
|
wolffd@0
|
471 else
|
wolffd@0
|
472 pmj = [];
|
wolffd@0
|
473 end
|
wolffd@0
|
474 if not(isempty(ppj))
|
wolffd@0
|
475 %plot((segt(j)+segt(j+1))/2,xx(ppj),'+k','MarkerSize',10)
|
wolffd@0
|
476 plot((ttt(ppj)+ttt(ppj+1))/2,(xxx(j)+xxx(j+1))/2,'+w','MarkerSize',10)
|
wolffd@0
|
477 end
|
wolffd@0
|
478 end
|
wolffd@0
|
479 end
|
wolffd@0
|
480 end
|
wolffd@0
|
481 if i == l
|
wolffd@0
|
482 title(t)
|
wolffd@0
|
483 end
|
wolffd@0
|
484 if i == 1
|
wolffd@0
|
485 xlabel('time axis (in s.)');
|
wolffd@0
|
486 end
|
wolffd@0
|
487 if l > 1
|
wolffd@0
|
488 if iscell(x)
|
wolffd@0
|
489 num = x{i}(1);
|
wolffd@0
|
490 else
|
wolffd@0
|
491 num = ch(i);
|
wolffd@0
|
492 end
|
wolffd@0
|
493 pos = get(gca,'Position');
|
wolffd@0
|
494 hfig = axes('Position',[pos(1)-.05 pos(2)+pos(4)/2 .01 .01],'Visible','off');
|
wolffd@0
|
495 text(0,0,num2str(num),'FontSize',12,'Color','r')
|
wolffd@0
|
496 end
|
wolffd@0
|
497 end
|
wolffd@0
|
498 end
|
wolffd@0
|
499 end
|
wolffd@0
|
500 if l == 1
|
wolffd@0
|
501 if curve
|
wolffd@0
|
502 %if (exist('dbv') == 1) && dbv
|
wolffd@0
|
503 % ylabel([ylab ' (logarithmic scale)']);
|
wolffd@0
|
504 %else
|
wolffd@0
|
505 ylabel(ylab);
|
wolffd@0
|
506 %end
|
wolffd@0
|
507 elseif manychannels
|
wolffd@0
|
508 ylabel('Channels');
|
wolffd@0
|
509 else
|
wolffd@0
|
510 ylabel(xlab)
|
wolffd@0
|
511 end
|
wolffd@0
|
512 end
|
wolffd@0
|
513 res = 1;
|
wolffd@0
|
514 drawnow |