diff listeningTest/multiComp/MpushW.m @ 0:4fd284285159

Adding listening test plus some helpful functions and scripts.
author Brecht <b.deman@qmul.ac.uk>
date Thu, 24 Apr 2014 23:53:31 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/listeningTest/multiComp/MpushW.m	Thu Apr 24 23:53:31 2014 +0100
@@ -0,0 +1,34 @@
+function MpushW(hf,typ)
+
+switch typ
+case '2D'
+   sel=get(hf,'selectiontype');
+   switch sel
+      
+   case 'normal'
+      % create a box
+      dat=get(hf,'userdata');
+      pc=get(hf,'currentpoint');
+      
+      %display box
+      pos=rbbox([pc(1) pc(2) 0 0]);
+      x1=pos(1); x2=pos(3)+x1; y1=pos(2); y2=pos(4)+y1;
+      grp=[];
+      for noIc=1:length(dat.hIcon)
+         posIc=get(dat.hIcon(noIc),'position');
+         xic=posIc(1); yic=posIc(2);
+         if ((xic>x1) & (xic<x2) & (yic>y1) & (yic<y2))
+            grp(end+1)=noIc;
+         end
+      end
+      if ~isempty(grp)
+         dat.group{end+1}=grp;
+         dat.com{end+1}=[];
+         dat.hbox(end+1)=line([x1 x1 x2 x2 x1],[y1 y2 y2 y1 y1]);
+         set(dat.hbox,'color','k');
+         set(dat.hbox,'linestyle','--');
+         set(dat.hbox,'linewidth',1);
+      end   
+      set(hf,'userdata',dat);
+   end
+end