Home > . > DIVA_GUI.m

DIVA_GUI

PURPOSE ^

DIVA_GUI DIVA Graphical User Interface

SYNOPSIS ^

function out=DIVA_GUI(varargin)

DESCRIPTION ^

 DIVA_GUI DIVA Graphical User Interface

 The DIVA_GUI Module provides a standard user interface for the DIVA model.  It
 allows the user to run DIVA simulations and observe changes in acoustic properties
 due to VocalTract manipulation.  The various DIVA components send their output streams
 to the GUI module for graphical display to the user.  In addition the user can save
 DIVA productions as sound WAV files or Quicktime movie MOV files.  The movie files
 consist of interlaced audio and video streams.  

 DIVA_GUI('init' [,SessionName]);          Initializes the module
 DIVA_GUI('save' [,SessionName] );         Saves state
 DIVA_GUI('exit');                         Exits the module (without saving)
 DIVA_GUI(PropertyName [,PropertyValue] )  Reads and writes internal model properties

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function out=DIVA_GUI(varargin)
0002 % DIVA_GUI DIVA Graphical User Interface
0003 %
0004 % The DIVA_GUI Module provides a standard user interface for the DIVA model.  It
0005 % allows the user to run DIVA simulations and observe changes in acoustic properties
0006 % due to VocalTract manipulation.  The various DIVA components send their output streams
0007 % to the GUI module for graphical display to the user.  In addition the user can save
0008 % DIVA productions as sound WAV files or Quicktime movie MOV files.  The movie files
0009 % consist of interlaced audio and video streams.
0010 %
0011 % DIVA_GUI('init' [,SessionName]);          Initializes the module
0012 % DIVA_GUI('save' [,SessionName] );         Saves state
0013 % DIVA_GUI('exit');                         Exits the module (without saving)
0014 % DIVA_GUI(PropertyName [,PropertyValue] )  Reads and writes internal model properties
0015 %
0016 
0017 % Dependencies:
0018 % fcn/DIVA_GUI_callbacks
0019 % fcn/DIVA_GUI_toolbox
0020 % fcn
0021 
0022 % 2007-03-26: (JSB) Added Experimental Control for simulation of noisy system and
0023 % perturbation studies
0024 
0025 % TODO % Perturbation capability
0026 
0027   out=[];
0028   global DIVA_GUI_data
0029 
0030   for indexargin=1:2:nargin,
0031     switch(varargin{indexargin}),
0032      case 'init',
0033       if strcmp(DIVA('status'),'off'),
0034         DIVA;
0035       else,
0036         SessionFolder=strcat(DIVA('SessionFolder'),filesep);
0037         if nargin<indexargin+1 || isempty(varargin{indexargin+1}),
0038           initfile='';
0039         else,
0040           initfile=[SessionFolder,'Session_',varargin{indexargin+1},...
0041                     filesep,mfilename,'.mat'];
0042         end
0043         if isempty(initfile) || isempty(dir(initfile)),
0044           disp([mfilename, ' : Defining new session...']);
0045           % INITIALIZES INTERNAL MODULE PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0046           DIVA_GUI_data.params=struct(...
0047               'act_plot',1,...      % Current active plot in 'other_weights'
0048               'train_sound',0,...   % GUI set to train a new sound (0: no, 1: train)
0049               'nTrain',2,...        % Number of training trials
0050               'current_file',[],... % Current training sound file
0051               'timepoint',0,...     % default timepoint for plot alignment
0052               'AutoMovie',1,...     % Automatically create a movie after training
0053               'duration',500);        % duration of VT sound generation
0054         else,
0055           data=load(initfile,'-mat');
0056           DIVA_GUI_data.params=data.params;
0057         end
0058         % INITIALIZES OTHER (TEMPORAL) PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0059         h=findobj('name','DIVA GUI');
0060         if isempty(h),
0061           DIVA_GUI_data.private.figurehandle=...
0062               figure('name','DIVA GUI','numbertitle', ...
0063                      'off','units','norm','menu','none', ...
0064                      'doublebuffer', 'on','color',[0.5 0.5 0.5],...
0065                      'PaperOrientation','landscape',...
0066                      'deletefcn','DIVA(''removemodule'',''GUI'');');
0067           ss=get(0,'ScreenSize');
0068           if(ss(3)>1400),
0069             set(DIVA_GUI_data.private.figurehandle,...
0070                 'position',[.1 .1 .45 .75]);
0071           else
0072             set(DIVA_GUI_data.private.figurehandle,...
0073                 'position',[.1 .1 .75 .75])
0074           end
0075           
0076           % don't know if I need handles for all this...not ever changing
0077           axes('position',[0 0 1 1],'xlim',[0 1],'ylim',[0 1],...
0078                'color',[0.5 0.5 0.5]);
0079           line([.32 .32],[0 1],'Color',[.7 .7 .7],'LineWidth',3);
0080           line([.65 .65],[0 1],'Color',[.7 .7 .7],'LineWidth',3);
0081           axis off;
0082 
0083           %---------------------DATA---------------------------------%
0084 
0085           DIVA_GUI_data.private.data.artics=...
0086               {'jh','tbp','tbs','ttp','lp','lh','ulp','llp'};
0087           DIVA_GUI_data.private.data.artic_label=...
0088               {'Jaw Height','Tongue Body Position',...
0089                'Tongue Body Shape','Tongue Tip Position','Lip Protrusion',...
0090                'Larynx Height','Upper Lip Position','Lower Lip Position'};
0091 
0092           DIVA_GUI_data.private.data.glot_label={'Ag0','AgP','F0'};
0093           DIVA_GUI_data.private.data.formant_label={'F1','F2','F3'};
0094           DIVA_GUI_data.private.data.showfmt=0;
0095           DIVA_GUI_data.private.data.diva_reps=...
0096               {'Motor Activity','Auditory Signal', 'Somatosensory Activity',...
0097                'Motor Weights','Somatosensory Weights', ...
0098                'Acoustic Error', 'Somatosensory Error'};
0099 
0100           %%%%%%%%%%%%%%%%%%%%%%%%% Menu Items %%%%%%%%%%%%%%%%%%%%%%%%%%
0101 
0102           %---------------File-----------------%
0103 
0104           DIVA_GUI_data.private.guimenu.file.main=...
0105               uimenu('label','File', 'tag','file', ...
0106                      'parent',DIVA_GUI_data.private.figurehandle,...
0107                      'position',1);
0108           DIVA_GUI_data.private.guimenu.file.new=...
0109               uimenu('label','New Session','tag','new',...
0110                      'parent',DIVA_GUI_data.private.guimenu.file.main,...
0111                      'position',1,'Callback',@gui_file_menu_cbk);
0112           DIVA_GUI_data.private.guimenu.file.load=...
0113               uimenu('label','Load Session','tag','load',...
0114                      'parent',DIVA_GUI_data.private.guimenu.file.main,...
0115                      'position',2,'Callback',@gui_file_menu_cbk);
0116           DIVA_GUI_data.private.guimenu.file.save=...
0117               uimenu('label','Save Session','tag','save',...
0118                      'parent',DIVA_GUI_data.private.guimenu.file.main,...
0119                      'position',3,'Callback',@gui_file_menu_cbk,...
0120                      'enable','on');
0121 
0122           DIVA_GUI_data.private.guimenu.export.main=...
0123               uimenu('label','Export','tag','export',...
0124                      'parent',DIVA_GUI_data.private.guimenu.file.main,...
0125                      'position',4,'separator','on');
0126 
0127           DIVA_GUI_data.private.guimenu.file.export.sound=...
0128               uimenu('label','Sound','tag','sound',...
0129                      'parent',DIVA_GUI_data.private.guimenu.export.main,...
0130                      'position',1,'callback',@gui_file_menu_cbk,...
0131                      'enable','off');
0132 
0133           DIVA_GUI_data.private.guimenu.file.export.movie=...
0134               uimenu('label','Movie','tag','movie',...
0135                      'parent',DIVA_GUI_data.private.guimenu.export.main,...
0136                      'position',2,'callback',@gui_file_menu_cbk,...
0137                      'enable','off');
0138 
0139           % Export plots
0140 
0141           DIVA_GUI_data.private.guimenu.file.screenshot=...
0142               uimenu('label','Screenshot','tag','screenshot',...
0143                      'parent',DIVA_GUI_data.private.guimenu.file.main,...
0144                      'position',5,'Callback',...
0145                      {@gui_file_menu_cbk,DIVA_GUI_data.private.figurehandle});
0146           DIVA_GUI_data.private.guimenu.file.exit=...
0147               uimenu('label','Exit','tag','exit',...
0148                      'parent',DIVA_GUI_data.private.guimenu.file.main,...
0149                      'separator','on',...
0150                      'position',6,'Callback',@gui_file_menu_cbk);
0151 
0152           %-----------Parameters------------------%
0153 
0154           DIVA_GUI_data.private.guimenu.parameters.main=...
0155               uimenu('label','Parameters','tag','param',...
0156                      'parent',DIVA_GUI_data.private.figurehandle,...
0157                      'position',2);
0158 
0159           %-----------------DIVA params-----------%
0160 
0161           DIVA_GUI_data.private.guimenu.parameters.diva.main=...
0162               uimenu('label','DIVA Control','tag','diva_params',...
0163                      'parent',DIVA_GUI_data.private.guimenu.parameters.main,...
0164                      'position',1);
0165 
0166           DIVA_GUI_data.private.guimenu.parameters.diva.timestep=...
0167               uimenu('label','Time Step','parent',...
0168                      DIVA_GUI_data.private.guimenu.parameters.diva.main,...
0169                      'position',1,'callback',{@gui_params_menu_cbk,...
0170                               struct('name','Time Step','param','TimeStep',...
0171                                      'range',[0.001 0.005],'module','DIVA')});
0172 
0173           DIVA_GUI_data.private.guimenu.parameters.diva.plotstep=...
0174               uimenu('label','Plot Step','parent',...
0175                      DIVA_GUI_data.private.guimenu.parameters.diva.main,...
0176                      'position',2,'callback',{@gui_params_menu_cbk,...
0177                               struct('name','Plot Step','param','PlotStep',...
0178                                      'range',[1 50],'module','DIVA')});
0179 
0180           DIVA_GUI_data.private.guimenu.parameters.diva.storagetime=...
0181               uimenu('label','Storage Time','parent',...
0182                      DIVA_GUI_data.private.guimenu.parameters.diva.main,...
0183                      'position',3,'callback',{@gui_params_menu_cbk,...
0184                               struct('name','Storage Time','param','StorageTime',...
0185                                      'range',[1 25],'module','DIVA')});
0186           
0187           DIVA_GUI_data.private.guimenu.parameters.diva.blockmode=...
0188               uimenu('label','Block Mode','parent',...
0189                      DIVA_GUI_data.private.guimenu.parameters.diva.main,...
0190                      'position',4,'callback',{@gui_params_menu_cbk,...
0191                               struct('name','Block Mode','param','BlockMode',...
0192                                      'range',[0 1],'module','DIVA')});
0193           if(DIVA('BlockMode')),
0194             set(DIVA_GUI_data.private.guimenu.parameters.diva.blockmode,'checked','on');
0195           else
0196             set(DIVA_GUI_data.private.guimenu.parameters.diva.blockmode,'checked','off');
0197           end
0198           
0199           %-------------------Motor Cortex params------------------%
0200 
0201           DIVA_GUI_data.private.guimenu.parameters.motor.main=...
0202               uimenu('label','Motor','tag','motor_params',...
0203                      'parent',DIVA_GUI_data.private.guimenu.parameters.main,...
0204                      'position',2);
0205 
0206           DIVA_GUI_data.private.guimenu.parameters.motor.eps_motor=...
0207               uimenu('label','Integration Rate','parent',...
0208                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0209                      'position',1,'callback',{@gui_params_menu_cbk,...
0210                               struct('name','eps_motor','param','eps_motor',...
0211                                      'range',[0 1],'module','MotorCortex')});
0212 
0213           DIVA_GUI_data.private.guimenu.parameters.motor.eps_decay=...
0214               uimenu('label','Decay Rate','parent',...
0215                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0216                      'position',2,'callback',{@gui_params_menu_cbk,...
0217                               struct('name','eps_decay','param','eps_decay',...
0218                                      'range',[0 1],'module','MotorCortex')});
0219 
0220           DIVA_GUI_data.private.guimenu.parameters.motor.weight_ff=...
0221               uimenu('label','Feedforward Weight','parent',...
0222                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0223                      'position',3,'separator','on',...
0224                      'callback',{@gui_params_menu_cbk,...
0225                               struct('name','Feedforward Weight',...
0226                                      'param','WeightFeedForward',...
0227                                      'range',[0 1],'module','MotorCortex')});
0228 
0229           DIVA_GUI_data.private.guimenu.parameters.motor.weight_fb=...
0230               uimenu('label','Feedback Weight','parent',...
0231                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0232                      'position',4,'separator','off',...
0233                      'callback',{@gui_params_menu_cbk,...
0234                               struct('name','Feedback Weight',...
0235                                      'param','WeightFeedBack',...
0236                                      'range',[0 1],'module','MotorCortex')});
0237 
0238           DIVA_GUI_data.private.guimenu.parameters.motor.weight_fba=...
0239               uimenu('label','Auditory Feedback Weight','parent',...
0240                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0241                      'position',5,'separator','off',...
0242                      'callback',{@gui_params_menu_cbk,...
0243                               struct('name','Auditory Feedback Weight',...
0244                                      'param','WeightFeedBack_sound',...
0245                                      'range',[0 1],'module','MotorCortex')});
0246 
0247           DIVA_GUI_data.private.guimenu.parameters.motor.weight_fbs=...
0248               uimenu('label','Somatosensory Feedback Weight','parent',...
0249                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0250                      'position',6,'separator','off','callback',...
0251                      {@gui_params_menu_cbk,...
0252                       struct('name','Somatosensory Feedback Weight',...
0253                              'param','WeightFeedBack_somatosensory',...
0254                              'range',[0 1],'module','MotorCortex')});
0255 
0256           DIVA_GUI_data.private.guimenu.parameters.motor.weight_learn=...
0257               uimenu('label','Learning Weight','parent',...
0258                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0259                      'position',7,'separator','on','callback',...
0260                      {@gui_params_menu_cbk,...
0261                       struct('name','Learning Weight',...
0262                              'param','WeightLearn',...
0263                              'range',[0 1],'module','MotorCortex')});
0264 
0265           DIVA_GUI_data.private.guimenu.parameters.motor.weight_learn_a=...
0266               uimenu('label','Learning Weight (auditory)','parent',...
0267                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0268                      'position',8,'separator','off','callback',...
0269                      {@gui_params_menu_cbk,...
0270                       struct('name','Learning Weight (auditory)',...
0271                              'param','WeightLearn_sound',...
0272                              'range',[0 1],'module','MotorCortex')});
0273 
0274           DIVA_GUI_data.private.guimenu.parameters.motor.weight_learn_s=...
0275               uimenu('label','Learning Weight (somatosensory)','parent',...
0276                      DIVA_GUI_data.private.guimenu.parameters.motor.main,...
0277                      'position',9,'separator','off','callback',...
0278                      {@gui_params_menu_cbk,...
0279                       struct('name','Learning Weight (somatosensory)',...
0280                              'param','WeightLearn_somatosensory',...
0281                              'range',[0 1],'module','MotorCortex')});
0282 
0283           %-------------------Somatosensory Cortex params------------------%
0284 
0285           DIVA_GUI_data.private.guimenu.parameters.somato.main=...
0286               uimenu('label','Somatosensory','tag','somato_params',...
0287                      'parent',DIVA_GUI_data.private.guimenu.parameters.main,...
0288                      'position',3);
0289 
0290           DIVA_GUI_data.private.guimenu.parameters.somato.eps_learn=...
0291               uimenu('label','Learning Rate','parent',...
0292                      DIVA_GUI_data.private.guimenu.parameters.somato.main,...
0293                      'position',1,'callback',...
0294                      {@gui_params_menu_cbk,...
0295                       struct('name','eps_learn',...
0296                              'param','eps_learn',...
0297                              'range',[0 1],'module','SomatosensoryCortex')});
0298 
0299           %-------------------All params------------------%
0300 
0301           DIVA_GUI_data.private.guimenu.parameters.all=...
0302               uimenu('label','Edit All','tag','all_params',...
0303                      'parent',DIVA_GUI_data.private.guimenu.parameters.main,...
0304                      'position',4,'separator','on','callback',...
0305                      @gui_all_params_cbk);
0306 
0307           %-------------------Plot Glottal params------------------%
0308 
0309           DIVA_GUI_data.private.guimenu.parameters.glot=...
0310               uimenu('label','View Glottal Trajectory','tag','glot_params',...
0311                      'parent',DIVA_GUI_data.private.guimenu.parameters.main,...
0312                      'position',5,'callback',@gui_params_menu_cbk);
0313 
0314           %---------------Target Source---------------%
0315 
0316           DIVA_GUI_data.private.guimenu.target.main=...
0317               uimenu('label','Target source','tag','target_menu',...
0318                      'parent',DIVA_GUI_data.private.figurehandle,...
0319                      'position',3);
0320           DIVA_GUI_data.private.guimenu.target.file=...
0321               uimenu('label','Auditory Target from file','tag','file',...
0322                      'parent',DIVA_GUI_data.private.guimenu.target.main,...
0323                      'position',1,'enable','on','Callback',...
0324                      @gui_targ_menu_cbk);
0325           DIVA_GUI_data.private.guimenu.target.synth=...
0326               uimenu('label','Synthesize Auditory Target','tag','synth',...
0327                      'parent',DIVA_GUI_data.private.guimenu.target.main,...
0328                      'position',2','enable','on','Callback',...
0329                      @gui_targ_menu_cbk);
0330           DIVA_GUI_data.private.guimenu.target.mic=...
0331               uimenu('label','Auditory Target from microphone','tag','mic',...
0332                      'parent',DIVA_GUI_data.private.guimenu.target.main,...
0333                      'position',3,'enable','off','Callback',...
0334                      @gui_targ_menu_cbk);
0335 
0336           %-------------Preferences-------------------%
0337 
0338           DIVA_GUI_data.private.guimenu.prefs.main=...
0339               uimenu('label','Preferences','tag','prefs_menu',...
0340                      'parent',DIVA_GUI_data.private.figurehandle,...
0341                      'position',4);
0342 
0343           DIVA_GUI_data.private.guimenu.prefs.ntrain=...
0344               uimenu('label','Number of Training Trials',...
0345                      'tag','nTrain',...
0346                      'parent',DIVA_GUI_data.private.guimenu.prefs.main,...
0347                      'position',1,'callback',@gui_prefs_menu_cbk);
0348 
0349           DIVA_GUI_data.private.guimenu.prefs.createMovie=...
0350               uimenu('label','Auto Movie Playback','tag','movie',...
0351                      'parent',DIVA_GUI_data.private.guimenu.prefs.main,...
0352                      'position',2,'callback',@gui_prefs_menu_cbk);
0353           if(DIVA_GUI_data.params.AutoMovie==1),
0354             set(DIVA_GUI_data.private.guimenu.prefs.createMovie,'checked','on');
0355           else
0356             set(DIVA_GUI_data.private.guimenu.prefs.createMovie,'checked','off');
0357           end
0358 
0359           %-------------Experimental Control-------------------------%
0360           
0361           DIVA_GUI_data.private.guimenu.expctrl.main = ...
0362               uimenu('label','Experimental Control','tag','exp_ctrl',...
0363                      'parent',DIVA_GUI_data.private.figurehandle,...
0364                      'position',5);
0365           DIVA_GUI_data.private.guimenu.expctrl.noise = ...
0366                uimenu('label','Model Noise','tag','noise',...
0367                       'parent',DIVA_GUI_data.private.guimenu.expctrl.main,...
0368                       'callback',@gui_expctrl_noise,'position',1);
0369           DIVA_GUI_data.private.guimenu.expctrl.perturb = ...
0370                uimenu('label','Perturbation','tag','perturb',...
0371                       'parent',DIVA_GUI_data.private.guimenu.expctrl.main,...
0372                       'position',2,'enable','off');
0373              
0374           %-------------About-------------------------%
0375 
0376           DIVA_GUI_data.private.guimenu.help.main=...
0377               uimenu('label','Help','tag','help_menu',...
0378                      'parent',DIVA_GUI_data.private.figurehandle,...
0379                      'position',6);
0380           DIVA_GUI_data.private.guimenu.help.diva=...
0381               uimenu('label','DIVA Help','tag','diva',...
0382                      'parent',DIVA_GUI_data.private.guimenu.help.main,...
0383                      'position',1,'Callback',@gui_help_menu_cbk);
0384           DIVA_GUI_data.private.guimenu.help.readme=...
0385               uimenu('label','Readme','tag','readme',...
0386                      'parent',DIVA_GUI_data.private.guimenu.help.main,...
0387                      'position',2,'Callback',@gui_help_menu_cbk);
0388 
0389           %%%%%%%%%%%%%%%%%%%% Model Section %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0390 
0391           DIVA_GUI_data.private.model.label.title = ...
0392               uicontrol('Style','text','parent',DIVA_GUI_data.private.figurehandle,...
0393                         'String','DIVA Model Control','units','norm',...
0394                         'fontunits','norm','fontsize',0.6,...
0395                         'position',[0.04 0.95 0.22 0.04],...
0396                         'backgroundcolor',[0.5 0.5 0.5]);
0397 
0398           %--------------------Learned Sounds-----------------------------%
0399 
0400           DIVA_GUI_data.private.model.menu.learned=...
0401               uicontrol('Style','popupmenu','parent',...
0402                         DIVA_GUI_data.private.figurehandle,...
0403                         'tag','menu',...
0404                         'String','----','Enable','off','units',...
0405                         'norm','position',[0.080 0.86 0.16 0.05],...
0406                         'FontUnits','norm','FontSize',0.3,...
0407                         'BackgroundColor',[0.5 0.5 0.5],...
0408                         'callback',@gui_model_cbk);
0409 
0410           DIVA_GUI_data.private.model.label.learned=...
0411               uicontrol('Style','text','parent',...
0412                         DIVA_GUI_data.private.figurehandle,...
0413                         'String','Stored Auditory Targets','Enable','on',...
0414                         'units','norm','position',[0.06 0.93 0.2 0.02],...
0415                         'FontUnits','norm','FontSize',0.9,...
0416                         'BackgroundColor',[0.5 0.5 0.5]);
0417 
0418           DIVA_GUI_data.private.model.button.train=...
0419               uicontrol('Style','pushbutton','parent',...
0420                         DIVA_GUI_data.private.figurehandle,...
0421                         'String','Practice Sound','Enable','off',...
0422                         'tag','train',...
0423                         'units','norm','position',[0.080 0.85 0.085 0.03],...
0424                         'FontUnits','norm','FontSize',0.45,...
0425                         'BackgroundColor',[0.5 0.5 0.5],...
0426                         'Callback',@gui_model_cbk);
0427 
0428           DIVA_GUI_data.private.model.button.reset=...
0429               uicontrol('Style','pushbutton','parent',...
0430                         DIVA_GUI_data.private.figurehandle,...
0431                         'String','Reset Weights','Enable','off',...
0432                         'tag','reset',...
0433                         'units','norm','position',[0.16 0.85 0.085 0.03],...
0434                         'FontUnits','norm','FontSize',0.45,...
0435                         'BackgroundColor',[0.5 0.5 0.5],...
0436                         'Callback',@gui_model_cbk);
0437 
0438           DIVA_GUI_data.private.model.button.play=...
0439               uicontrol('Style','pushbutton','parent',...
0440                         DIVA_GUI_data.private.figurehandle,...
0441                         'tag','play',...
0442                         'String','Play Stored Video','Enable','off','units',...
0443                         'norm','position',[0.080 0.82 0.085 0.03],...
0444                         'FontUnits','norm','FontSize',0.45,...
0445                         'BackgroundColor',[0.5 0.5 0.5],...
0446                         'Callback',@gui_model_cbk);
0447 
0448           DIVA_GUI_data.private.model.button.produce=...
0449               uicontrol('Style','pushbutton','parent',...
0450                         DIVA_GUI_data.private.figurehandle,...
0451                         'tag','produce',...
0452                         'String','Produce Sound','Enable','off','units',...
0453                         'norm','position',[0.16 0.82 0.085 0.03],...
0454                         'FontUnits','norm','FontSize',0.45,...
0455                         'BackgroundColor',[0.5 0.5 0.5],...
0456                         'Callback',@gui_model_cbk);
0457 
0458           %-----------------Target Specification---------------------%
0459 
0460           DIVA_GUI_data.private.model.label.target_file=...
0461               uicontrol('Style','text','parent',...
0462                         DIVA_GUI_data.private.figurehandle,...
0463                         'String',[],'Enable','on',...
0464                         'units','norm','position',[0.06 0.75 0.1 0.03],...
0465                         'FontUnits','norm','FontSize',0.5,...
0466                         'BackgroundColor',[0.7 0.7 0.7],...
0467                         'HorizontalAlignment','center');
0468 
0469           DIVA_GUI_data.private.model.button.target_file=...
0470               uicontrol('Style','pushbutton','parent',...
0471                         DIVA_GUI_data.private.figurehandle,...
0472                         'tag','browse',...
0473                         'String','Browse','Enable','on',...
0474                         'units','norm','position',[0.16 0.75 0.075 0.03],...
0475                         'FontUnits','norm','FontSize',0.4,...
0476                         'BackgroundColor',[0.5 0.5 0.5],...
0477                         'Callback',@gui_model_cbk);
0478 
0479           if(exist(['data',filesep,'mic1_new.jpeg'],'file'))
0480             mic=double(imread(['data',filesep,'mic1_new.jpeg']))/255;
0481             mic_str=[];
0482             bColor=[0.5 0.5 0.5];
0483           else
0484             mic=[];
0485             mic_str='mic';
0486             bColor=[0.5 0.5 0.5];
0487           end
0488           DIVA_GUI_data.private.model.button.target_mic=...
0489               uicontrol('Style','pushbutton','parent',...
0490                         DIVA_GUI_data.private.figurehandle,...
0491                         'CData',mic,'tag','mic',...
0492                         'String',mic_str,'Enable','off',...
0493                         'units','norm','position',[0.235 0.75 0.025 0.03],...
0494                         'FontUnits','norm','FontSize',0.3,...
0495                         'BackgroundColor',bColor);
0496 
0497           DIVA_GUI_data.private.model.label.target=...
0498               uicontrol('Style','text','parent',...
0499                         DIVA_GUI_data.private.figurehandle,...
0500                         'String','Speech Sound Target',...
0501                         'Enable','on','units','norm',...
0502                         'position',[0.06 0.78 0.2 0.02],...
0503                         'FontUnits','norm','FontSize',0.7,...
0504                         'BackgroundColor',[0.5 0.5 0.5]);
0505 
0506           DIVA_GUI_data.private.model.button.acquire=...
0507               uicontrol('Style','pushbutton','parent',...
0508                         DIVA_GUI_data.private.figurehandle,...
0509                         'tag','acquire',...
0510                         'String','Acquire Target','Enable','off',...
0511                         'units','norm','position',[0.06 0.72 0.2 0.03],...
0512                         'FontUnits','norm','FontSize',0.5,...
0513                         'BackgroundColor',[0.5 0.5 0.5],...
0514                         'Callback',@gui_model_cbk);
0515 
0516           %-------------------- Auditory Representation------------------%
0517 
0518           DIVA_GUI_data.private.model.guiaxes.auditory=...
0519               axes('Position',[0.05 0.45 0.22 0.22],'color','w',...
0520                    'parent',DIVA_GUI_data.private.figurehandle,...
0521                    'visible','on','xlim',...
0522                    [0 DIVA('AuditoryCortexCategorical','ntimepoints')],...
0523                    'ylim',[0 3500],...
0524                    'buttondownfcn',@gui_plot_align);
0525 
0526           nFormants=DIVA('AuditoryCortex','nFormants');
0527           DIVA_GUI_data.private.model.traces.auditory = ...
0528               zeros(nFormants,1);
0529           DIVA_GUI_data.private.model.target.auditory = ...
0530               zeros(nFormants*2,1);
0531           for n=1:nFormants,
0532             DIVA_GUI_data.private.model.traces.auditory(n) = ...
0533                 line([0 0],[0 0],'color','r','visible','off',...
0534                      'ButtonDownFcn',@gui_plot_align);
0535             DIVA_GUI_data.private.model.target.auditory(n) = ...
0536                 line([0 0],[0 0],'color','k','visible','off',...
0537                      'ButtonDownFcn',@gui_plot_align);
0538             DIVA_GUI_data.private.model.target.auditory(n+nFormants) = ...
0539                 line([0 0],[0 0],'color','k','visible','off',...
0540                      'ButtonDownFcn',@gui_plot_align);
0541           end
0542           DIVA_GUI_data.private.model.timeline.auditory = ...
0543               line([0 0],[0 0],'color','k','visible','off',...
0544                    'parent',DIVA_GUI_data.private.model.guiaxes.auditory,...
0545                    'buttondownfcn',@gui_plot_align);
0546 
0547           DIVA_GUI_data.private.model.title.auditory=...
0548               title('Auditory Representation from Target','parent',...
0549                     DIVA_GUI_data.private.model.guiaxes.auditory,...
0550                     'visible','on');
0551           axis xy;
0552 
0553           %--------------Other Model Representations-------------------%
0554 
0555           cco=[0 0 1;1 0 0;0 .5 0;0 0 0];
0556           rco=rand(7,3);
0557           rco=rco-repmat(min(rco,[],1),7,1);
0558           rco=rco*diag(1./max(rco,[],1));
0559           nco=[cco;rco];
0560 
0561           DIVA_GUI_data.private.model.guiaxes.other=...
0562               axes('Position',[0.05 0.1 0.22 0.22],'color','w',...
0563                    'parent',DIVA_GUI_data.private.figurehandle,...
0564                    'visible','on','xlim',...
0565                    [0 DIVA('AuditoryCortexCategorical','ntimepoints')],...
0566                    'ylim',[0 1],'colororder',nco);
0567 
0568           DIVA_GUI_data.private.model.timeline.other=...
0569               line([0 0],[0 0],'color','k','visible','off',...
0570                    'buttondownfcn',@gui_plot_align);
0571 
0572           DIVA_GUI_data.private.model.menu.other=...
0573               uicontrol('style','popupmenu','parent',...
0574                         DIVA_GUI_data.private.figurehandle,...
0575                         'String',DIVA_GUI_data.private.data.diva_reps,...
0576                         'Enable','on','units','norm',...
0577                         'tag','other',...
0578                         'position',[0.05 0.32 0.22 0.05],...
0579                         'FontUnits','norm','FontSize',0.3,...
0580                         'BackgroundColor',[0.5 0.5 0.5],...
0581                         'Callback',@gui_model_cbk);
0582 
0583           maxModeDim = max([DIVA('AuditoryCortex','nFormants'),...
0584                             DIVA('MotorCortex','nMotor'),...
0585                             DIVA('SomatosensoryCortex','nSensory')]);
0586 
0587           DIVA_GUI_data.private.model.traces.other = zeros(maxModeDim,1);
0588           for n=1:maxModeDim,
0589             DIVA_GUI_data.private.model.traces.other(n) = ...
0590                 line([0 0],[0 0],'visible','off',...
0591                      'parent',DIVA_GUI_data.private.model.guiaxes.other,...
0592                      'buttondownfcn',@gui_plot_align);
0593           end
0594 
0595           %%%%%%%%%%%%%% Auditory Section %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0596 
0597           DIVA_GUI_data.private.auditory.label.acoustic=...
0598               uicontrol('style','text','units','norm',...
0599                         'position',[0.39 0.95 0.24 0.04],...
0600                         'String',sprintf('Acoustic Representations'),...
0601                         'parent',DIVA_GUI_data.private.figurehandle,...
0602                         'BackgroundColor',[0.5 0.5 0.5],'FontUnits',...
0603                         'norm','FontSize',0.6);
0604 
0605           %---------------- Formant Representation ----------------%
0606 
0607           DIVA_GUI_data.private.auditory.label.formant=...
0608               uicontrol('style','text','units','norm',...
0609                         'position',[0.41 0.875 0.2 0.025],...
0610                         'string','Formant Values (Hz)',...
0611                         'parent',DIVA_GUI_data.private.figurehandle,...
0612                         'BackgroundColor',[0.5 0.5 0.5],...
0613                         'FontUnits','norm','FontSize',0.6);
0614 
0615           fmt_label=DIVA_GUI_data.private.data.formant_label;
0616           for i=1:length(fmt_label)
0617             DIVA_GUI_data.private.auditory.label.(fmt_label{i})=...
0618                 uicontrol('style','text','units','norm',...
0619                           'position',[0.41+(i-1)*(.2/3) 0.855 0.05 0.015],...
0620                           'FontUnits','norm','FontSize',0.9,...
0621                           'string',fmt_label{i},'parent', ...
0622                           DIVA_GUI_data.private.figurehandle,...
0623                           'BackgroundColor',[0.5 0.5 0.5]);
0624           end
0625           for i=1:length(fmt_label)
0626             DIVA_GUI_data.private.auditory.edit.(fmt_label{i})=...
0627                 uicontrol('style','edit','units','norm',...
0628                           'tag','fmt',...
0629                           'position',[0.41+(i-1)*(.2/3) 0.82 0.05 0.03],...
0630                           'string',0,'enable','on','parent',...
0631                           DIVA_GUI_data.private.figurehandle,...
0632                           'callback',@gui_auditory_cbk);
0633           end
0634 
0635           DIVA_GUI_data.private.auditory.button.go=...
0636               uicontrol('style','pushbutton','units','norm',...
0637                         'position',[0.41 0.78 2*.2/3+0.052 0.03],...
0638                         'string','GO','enable','on','parent',...
0639                         DIVA_GUI_data.private.figurehandle,...
0640                         'tag','go','callback',@gui_auditory_cbk);
0641 
0642           % ---------------- Spectral Representation Plot ---------------%
0643 
0644           DIVA_GUI_data.private.auditory.guiaxes.spectral=...
0645               axes('Position',[0.4 0.45 0.22 0.22],'color','w',...
0646                    'parent',DIVA_GUI_data.private.figurehandle,...
0647                    'visible','on','xlim',[1 20],'ylim',[0 3500]);
0648           DIVA_GUI_data.private.auditory.gui_image.spectral=...
0649               image(zeros(257,200),'visible','off');
0650           title('Spectral Representation','Parent',...
0651                 DIVA_GUI_data.private.auditory.guiaxes.spectral);
0652           %load 'data/specgram_cmap.mat'
0653           %colormap(DIVA_GUI_data.private.auditory.guiaxes.spectral,cmap);
0654           colormap(DIVA_GUI_data.private.auditory.guiaxes.spectral,1-gray);
0655 
0656           axis xy;
0657 
0658           DIVA_GUI_data.private.auditory.traces.f1=...
0659               line([1 10],...
0660                    [1 1],'Color','blue','LineWidth',2.5,'Visible','off');
0661           DIVA_GUI_data.private.auditory.traces.f2=...
0662               line([1 10],...
0663                    [1 1],'Color','green','LineWidth',2.5,'Visible','off');
0664           DIVA_GUI_data.private.auditory.traces.f3=...
0665               line([1 10],...
0666                    [1 1],'Color','red','LineWidth',2.5,'Visible','off');
0667 
0668           % -------------- Auditory Space (F1/F2) Plot ----------%
0669 
0670           DIVA_GUI_data.private.auditory.guiaxes.fmt_space=...
0671               axes('Position',[0.40 0.1 0.22 0.22],'color','w',...
0672                    'parent',DIVA_GUI_data.private.figurehandle,...
0673                    'visible','on','tag','fmt_space',...
0674                    'ButtonDownFcn',@gui_auditory_cbk);
0675           % Callback for clicking plot, move to vowels specified by click location
0676           au_fmt_space_init(DIVA_GUI_data.private.auditory.guiaxes.fmt_space);
0677 
0678           DIVA_GUI_data.private.auditory.crosshair.xline=...
0679               line(get(DIVA_GUI_data.private.auditory.guiaxes.fmt_space,'xlim'),...
0680                    ones(1,2)*mean(get(DIVA_GUI_data.private.auditory.guiaxes.fmt_space,'ylim')),...
0681                    'Color','black','tag','fmt_space','buttondownfcn',@gui_auditory_cbk);
0682           DIVA_GUI_data.private.auditory.crosshair.yline=...
0683               line(ones(1,2)*mean(get(DIVA_GUI_data.private.auditory.guiaxes.fmt_space,'xlim')),...
0684                    get(DIVA_GUI_data.private.auditory.guiaxes.fmt_space,'ylim'),...
0685                    'Color','black','tag','fmt_space','buttondownfcn',@gui_auditory_cbk);
0686 
0687           %%%%%%%%%%%%%%%%%%%%%%%%% Vocal Tract %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0688 
0689           DIVA_GUI_data.private.vocaltract.label.title = ...
0690               uicontrol('Style','text','parent',DIVA_GUI_data.private.figurehandle,...
0691                         'String','Vocal Tract Control','units','norm',...
0692                         'fontunits','norm','fontsize',0.6,...
0693                         'position',[0.72 0.95 0.22 0.04],...
0694                         'backgroundcolor',[0.5 0.5 0.5]);
0695 
0696           
0697           artics=DIVA_GUI_data.private.data.artics;
0698           artic_label=DIVA_GUI_data.private.data.artic_label;
0699 
0700           DIVA_GUI_data.private.vocaltract.label.artic=...
0701               uicontrol('style','text','units','norm',...
0702                         'position',[0.72 0.89 0.1 0.05],...
0703                         'String',sprintf('Articulatory Configuration'),...
0704                         'parent',DIVA_GUI_data.private.figurehandle,...
0705                         'BackgroundColor',[0.5 0.5 0.5],'FontUnits',...
0706                         'norm','FontSize',0.3);
0707 
0708           %--------------- VT Control -----------------------%
0709 
0710           DIVA_GUI_data.private.vocaltract.button.random=...
0711               uicontrol('style','pushbutton','units','norm',...
0712                         'position',[0.89 0.92 0.05 0.03],...
0713                         'String','Random','parent',...
0714                         DIVA_GUI_data.private.figurehandle,...
0715                         'BackgroundColor',[0.5 0.5 0.5],'Enable','on',...
0716                         'FontUnits','norm','FontSize',0.45,...
0717                         'tag','random',...
0718                         'Callback',{@gui_vocaltract_cbk,...
0719                               DIVA_GUI_data.private.data.artics});
0720 
0721           DIVA_GUI_data.private.vocaltract.button.reset=...
0722               uicontrol('style','pushbutton','units','norm',...
0723                         'position',[0.89 0.89 0.05 0.03],...
0724                         'String','Reset','parent',...
0725                         DIVA_GUI_data.private.figurehandle,...
0726                         'BackgroundColor',[0.5 0.5 0.5],'Enable','on',...
0727                         'FontUnits','norm','FontSize',0.5,...
0728                         'tag','reset',...
0729                         'Callback',{@gui_vocaltract_cbk,...
0730                               {DIVA_GUI_data.private.data.artics,...
0731                               DIVA_GUI_data.private.data.glot_label}});
0732 
0733           maxVal=DIVA('VocalTract','MaedaSpread');
0734           minVal=-DIVA('VocalTract','MaedaSpread');
0735           sstep=[0.01 0.1]./(2*DIVA('VocalTract','MaedaSpread'));
0736           for i=1:8
0737             DIVA_GUI_data.private.vocaltract.slider.(artics{i})=...
0738                 uicontrol('style','slider','value',0.00,...
0739                           'units','norm','tag','articslider',...
0740                           'position',[0.67+0.2*(1/3)+0.005 0.84-(.045*(i-1)) ...
0741                                 0.2*(2/3)-0.005 0.015],...
0742                           'parent',DIVA_GUI_data.private.figurehandle,...
0743                           'enable','on','Callback',{@gui_vocaltract_cbk},...
0744                           'UserData',artics{i},'min',minVal,'max',maxVal,...
0745                           'SliderStep',sstep);
0746 
0747             DIVA_GUI_data.private.vocaltract.edit.(artics{i})=...
0748                 uicontrol('style','edit','string','0.00',...
0749                           'units','norm','tag','articedit',...
0750                           'position',[0.89 0.845-(0.045*(i-1)) 0.05 0.02],...
0751                           'parent',DIVA_GUI_data.private.figurehandle,...
0752                           'enable','on','FontUnits','norm','FontSize',0.6,...
0753                           'Callback',@gui_vocaltract_cbk,'UserData',artics{i});
0754 
0755             sl_hlist=[DIVA_GUI_data.private.vocaltract.slider.(artics{i}),...
0756                       DIVA_GUI_data.private.vocaltract.edit.(artics{i})];
0757             align(sl_hlist,'none','middle');
0758 
0759             numspace=findstr(' ',artic_label{i});
0760             if(length(artic_label{i})>=14)
0761               bottom=0.845-(0.045*(i-1))-0.01;
0762               height=0.04;
0763               fsize=0.7/2;
0764               lbl=sprintf('%s\n%s',artic_label{i}(1:numspace(end)-1),...
0765                           artic_label{i}(numspace(end)+1:end));
0766             else
0767               bottom=0.845-(0.045*(i-1));
0768               height=0.02;
0769               fsize=0.7;
0770               lbl=artic_label{i};
0771             end
0772             DIVA_GUI_data.private.vocaltract.label.(artics{i})=...
0773                 uicontrol('style','text','units','norm',...
0774                           'position',[0.67 bottom 0.2*(1/3) height],...
0775                           'String',lbl,'enable','on',...
0776                           'parent',DIVA_GUI_data.private.figurehandle,...
0777                           'HorizontalAlignment','left',...
0778                           'BackgroundColor',[0.5 0.5 0.5],'FontUnits','norm',...
0779                           'FontSize',fsize);
0780           end % Articulator param control loop
0781 
0782           glot_label=DIVA_GUI_data.private.data.glot_label;
0783           for i=1:3
0784             if(i==3)
0785               max_sl=200;min_sl=0;
0786               sstep=[1 10]./(max_sl-min_sl);
0787               startval='100';
0788               unitstr='Hz';
0789             else
0790               if(strcmp(glot_label{i},'Ag0'))
0791                 max_sl=1;
0792                 min_sl=0;
0793                 sstep=[0.01 0.1]./(max_sl-min_sl);
0794                 startval='0.01';
0795                 unitstr='';
0796               else
0797                 max_sl=1;
0798                 min_sl=0;
0799                 sstep=[0.01 0.1]./(max_sl-min_sl);
0800                 startval='0.2';
0801                 unitstr='';
0802               end
0803             end
0804             DIVA_GUI_data.private.vocaltract.slider.(glot_label{i})=...
0805                 uicontrol('style','slider','min',min_sl,'max',max_sl,...
0806                           'units','norm','tag','glotslider',...
0807                           'position',[0.72 0.47-(0.03*(i-1)) 0.15 0.013],...
0808                           'parent',DIVA_GUI_data.private.figurehandle,...
0809                           'enable','on','SliderStep',sstep,...
0810                           'UserData',glot_label{i},'value',str2double(startval),...
0811                           'Callback',@gui_vocaltract_cbk);
0812 
0813             DIVA_GUI_data.private.vocaltract.edit.(glot_label{i})=...
0814                 uicontrol('style','edit','string',startval,...
0815                           'units','norm','tag','glotedit',...
0816                           'position',[0.89 0.47-(0.03*(i-1)) 0.05 0.02],...
0817                           'parent',DIVA_GUI_data.private.figurehandle,...
0818                           'enable','on','FontUnits','norm','FontSize',0.6,...
0819                           'UserData',struct('max',max_sl,'min',min_sl,...
0820                                             'name',glot_label{i}),...
0821                           'callback',@gui_vocaltract_cbk);
0822 
0823             sl_hlist=[DIVA_GUI_data.private.vocaltract.slider.(glot_label{i}),...
0824                       DIVA_GUI_data.private.vocaltract.edit.(glot_label{i})];
0825             align(sl_hlist,'none','middle');
0826 
0827             if(strcmp(glot_label{i},'F0'))
0828               lbl='Mean F0';
0829             else
0830               lbl=glot_label{i};
0831             end
0832             
0833             DIVA_GUI_data.private.vocaltract.label.(glot_label{i})=...
0834                 uicontrol('style','text','units','norm',...
0835                           'position',[0.67 0.47-(0.03*(i-1)) 0.05 0.02],...
0836                           'String',lbl,'enable','on',...
0837                           'parent',DIVA_GUI_data.private.figurehandle,...
0838                           'HorizontalAlignment','left',...
0839                           'BackgroundColor',[0.5 0.5 0.5],'FontUnits','norm',...
0840                           'FontSize',0.6);
0841 
0842             DIVA_GUI_data.private.vocaltract.unitlabel.(glot_label{i})=...
0843                 uicontrol('style','text','units','norm',...
0844                           'position',[0.94 0.47-(0.03*(i-1)) 0.05 0.02],...
0845                           'String',unitstr,'enable','on',...
0846                           'parent',DIVA_GUI_data.private.figurehandle,...
0847                           'FontUnits','norm','FontSize',0.6,...
0848                           'HorizontalAlignment','left',...
0849                           'BackgroundColor',[0.5 0.5 0.5]);
0850           end % Glottis param control loop
0851 
0852           %----------------Display VT ---------------------%%
0853 
0854           DIVA_GUI_data.private.vocaltract.guiaxes.vtplot=...
0855               axes('Position',[0.67 0.1 0.2 0.3],'color','w',...
0856                    'parent',DIVA_GUI_data.private.figurehandle,...
0857                    'visible','on');
0858           axis off;
0859           imagesc([]);
0860           set(DIVA_GUI_data.private.vocaltract.guiaxes.vtplot,...
0861               'xtick',[],'xticklabel',[],'ytick',[],'yticklabel',[]);
0862           
0863           DIVA_GUI_data.private.vocaltract.edit.duration=...
0864               uicontrol('style','edit','units','norm',...
0865                         'position',[0.89 0.24 0.05 0.03],...
0866                         'String','500','tag','duration',...
0867                         'parent',DIVA_GUI_data.private.figurehandle,...
0868                         'BackgroundColor',[0.5 0.5 0.5],'enable','on',...
0869                         'FontUnits','norm','FontSize',0.4,...
0870                         'callback',@gui_vocaltract_cbk);
0871           DIVA_GUI_data.private.vocaltract.label.duration=...
0872               uicontrol('style','text','units','norm',...
0873                         'position',[0.94,0.245 0.05 0.02],...
0874                         'String','ms','tag','duration',...
0875                         'parent',DIVA_GUI_data.private.figurehandle,...
0876                         'BackgroundColor',[0.5 0.5 0.5],'enable','on',...
0877                         'FontUnits','norm','FontSize',0.9,...
0878                         'HorizontalAlignment','left');
0879                               
0880           DIVA_GUI_data.private.vocaltract.button.generate=...
0881               uicontrol('style','pushbutton','units','norm',...
0882                         'position',[0.89 0.27 0.10 0.03],...
0883                         'String','Generate Sound','tag','generate',...
0884                         'parent',DIVA_GUI_data.private.figurehandle,...
0885                         'BackgroundColor',[0.5 0.5 0.5],'Enable','on',...
0886                         'FontUnits','norm','FontSize',0.5,...
0887                         'Callback',{@gui_vocaltract_cbk,...
0888                               {DIVA_GUI_data.private.data.artics,...
0889                               DIVA_GUI_data.private.data.glot_label}});
0890 
0891           DIVA_GUI_data.private.vocaltract.button.learn=...
0892               uicontrol('style','pushbutton','units','norm',...
0893                         'position',[0.89 0.30 0.1 0.03],...
0894                         'String',sprintf('Store Target'),...
0895                         'tag','learn',...
0896                         'parent',DIVA_GUI_data.private.figurehandle,...
0897                         'BackgroundColor',[0.5 0.5 0.5],'Enable','on',...
0898                         'FontUnits','norm','FontSize',0.5,...
0899                         'Callback',{@gui_vocaltract_cbk,...
0900                               {DIVA_GUI_data.private.data.artics,...
0901                               DIVA_GUI_data.private.data.glot_label}});
0902         end
0903 
0904         DIVA_GUI('ACC_AuditoryTargets',...
0905                  DIVA('AuditoryCortexCategorical','AuditoryTargets'));        
0906         DIVA_GUI('VT_Configuration',DIVA('VocalTract','current'));
0907         artic=DIVA_GUI('artic_slider',[]);
0908         temp=DIVA('VocalTract','motor',artic);
0909         DIVA_GUI('FmtSpace_crosshairs',temp{1});
0910         DIVA_GUI('FmtValues',temp{1});
0911         
0912         % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0913         % LIST OF MODULE CHANNELS
0914         % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0915         out ={};
0916         % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0917       end
0918 
0919       %--------------------------------------------------------------%
0920 
0921      case 'AC_WeightsFromTargets',
0922       set(DIVA_GUI_data.private.model.guiaxes.auditory,'visible','on');
0923 
0924       if(strcmp(varargin{indexargin+1},'update')),
0925         % Plot updated auditory representation traces
0926         searchTarg = DIVA('AuditoryCortex','target',[],...
0927                           DIVA('TimeStep')*(-1000:0));
0928         idx = getQueueIdx(searchTarg);
0929         au=DIVA('AuditoryCortex','sound',[],DIVA('TimeStep')*(-idx:0));
0930         targ=searchTarg(1000-idx+1:end);
0931         [targ,au]=chompIdx(targ,au);
0932 
0933         % update values of each formant line graphics object
0934         if(~isempty(au) && (mod(length(targ),DIVA('PlotStep'))==0 || ...
0935                            ~any(DIVA('busy'))))
0936           for n=1:DIVA('AuditoryCortex','nFormants')
0937             set(DIVA_GUI_data.private.model.traces.auditory(n),...
0938                 'YData',au(n,:),...
0939                 'XData',targ,...
0940                 'visible','on');
0941           end
0942         end
0943       elseif(strcmp(varargin{indexargin+1},'target'))
0944         % Plot auditory target regions
0945         au=DIVA('AuditoryCortex','WeightsFromTargets');
0946         if(~isempty(au))
0947           set(DIVA_GUI_data.private.model.button.train,'enable','on');
0948           set(DIVA_GUI_data.private.model.button.reset,'enable','on');
0949         end
0950         searchTarg=DIVA('AuditoryCortex','target',[],...
0951                         DIVA('TimeStep')*(-1000:0));
0952         idx=getQueueIdx(searchTarg);
0953         targ=searchTarg(1000-idx+1:end);
0954 
0955         if(~isempty(au) && DIVA('AuditoryCortexCategorical','match')~=-1)
0956           matchstart = DIVA('AuditoryCortexCategorical','ntimepoints')*...
0957               DIVA('AuditoryCortexCategorical','match')+1;
0958           matchend = matchstart+DIVA('AuditoryCortexCategorical','ntimepoints')-1;
0959           set(DIVA_GUI_data.private.model.guiaxes.auditory,...
0960               'Xlim',[matchstart matchend]);
0961           for n=1:size(au,1),
0962             set(DIVA_GUI_data.private.model.target.auditory(n),...
0963                 'XData',matchstart:matchend,...
0964                 'YData',au(n,matchstart:matchend),...
0965                 'visible','on');
0966           end
0967         end
0968       end
0969 
0970       %--------------------------------------------------------------%
0971 
0972      case 'FmtSpace_crosshairs'
0973       f1=varargin{indexargin+1}(1);
0974       f2=varargin{indexargin+1}(2);
0975 
0976       set(DIVA_GUI_data.private.auditory.crosshair.xline,...
0977           'YData',[f2 f2]);
0978 
0979       set(DIVA_GUI_data.private.auditory.crosshair.yline,...
0980           'XData',[f1 f1]);
0981 
0982       %--------------------------------------------------------------%
0983 
0984      case 'FmtValues'
0985       fmt_label=DIVA_GUI_data.private.data.formant_label;
0986       if(~nargout)
0987         for i=1:length(fmt_label)
0988           set(DIVA_GUI_data.private.auditory.edit.(fmt_label{i}),...
0989               'string',sprintf('%d',round(varargin{indexargin+1}(i))),...
0990               'value',varargin{indexargin+1}(i));
0991         end
0992       else
0993         for i=1:length(fmt_label)
0994           out(i)=get(DIVA_GUI_data.private.auditory.edit.(fmt_label{i}),...
0995                       'value');
0996         end
0997       end
0998 
0999       %--------------------------------------------------------------%
1000 
1001      case 'timealign'
1002       idx=varargin{indexargin+1};
1003       if(idx > 0)
1004         set(DIVA_GUI_data.private.model.timeline.auditory,...
1005             'Xdata',[idx idx],...
1006             'Ydata',get(DIVA_GUI_data.private.model.guiaxes.auditory,'Ylim'),...
1007             'visible','on');
1008         set(DIVA_GUI_data.private.model.timeline.other,...
1009             'Xdata',[idx idx],...
1010             'Ydata',get(DIVA_GUI_data.private.model.guiaxes.other,'Ylim'),...
1011             'visible','on');
1012         DIVA_GUI('timepoint',idx);
1013 
1014         searchIdx=DIVA('TimeStep')*(-1000:0);
1015         motor_idx_list=DIVA('MotorCortex','target',[],searchIdx);
1016         aud_idx_list=DIVA('AuditoryCortex','target',[],searchIdx);
1017         if(~isempty(motor_idx_list) && ~isempty(aud_idx_list))
1018 
1019           [nil motor_idx]=sort(abs(motor_idx_list-idx));
1020           [nil aud_idx]=sort(abs(aud_idx_list-idx));
1021 
1022           motor=DIVA('VocalTract','motor',[],searchIdx(motor_idx(1)));
1023           auditory=DIVA('AuditoryCortex','sound',[],searchIdx(motor_idx(1)));
1024           DIVA('GUI','FmtValues',(auditory));
1025           %DIVA('GUI','FmtSpace_crosshairs',mel(auditory));
1026           DIVA('GUI','FmtSpace_crosshairs',(auditory));
1027 
1028           artic=DIVA('VocalTract','motor',motor);
1029           artic=artic{2};
1030           DIVA('GUI','artic_edit',artic(1:DIVA('VocalTract','nArtic'),:));
1031           DIVA('GUI','artic_slider',artic(1:DIVA('VocalTract','nArtic'),:));
1032           DIVA('GUI','VT_Configuration',motor);
1033         end
1034       end
1035 
1036       %--------------------------------------------------------------%
1037 
1038      case 'Cochlea_plot'
1039       set(DIVA_GUI_data.private.auditory.guiaxes.spectral,'visible','on');
1040       set(DIVA_GUI_data.private.auditory.gui_image.spectral,'visible','on');
1041 
1042       % assume varargin{indexargin+1} is a sound waveform
1043       out=DIVA('Cochlea','spectrogram',varargin{indexargin+1});
1044       [nil,idx]=sort(abs(out{2}-3500));      
1045       set(DIVA_GUI_data.private.auditory.guiaxes.spectral,'xlim',[0 size(out{1},2)],...
1046                         'ylim',[1 idx(1)]);
1047       set(DIVA_GUI_data.private.auditory.gui_image.spectral,'cdata',...
1048                         64*abs(out{1}/max(max(abs(out{1})))),'cdatamapping','direct');
1049       set(DIVA_GUI_data.private.auditory.guiaxes.spectral,'ytick',20:20:length(out{2}));
1050       set(DIVA_GUI_data.private.auditory.guiaxes.spectral,'xtick',[]);
1051       set(DIVA_GUI_data.private.auditory.guiaxes.spectral,'yticklabel',...
1052                         round(out{2}(get(DIVA_GUI_data.private.auditory.guiaxes.spectral,'ytick'))));
1053 
1054       %--------------------------------------------------------------%
1055 
1056      case 'ACC_AuditoryTargets',
1057       if(~isempty(varargin{indexargin+1}))
1058         targmenu={};
1059         targmenu{1}='Select One';
1060         if(ischar(varargin{indexargin+1})),
1061           targs=DIVA('AuditoryCortexCategorical','AuditoryTargets');
1062           for n=1:length(targs),
1063             targmenu{n+1}=sprintf('%s\t%s',targs(n).label,...
1064                                 ['(',num2str(targs(n).ntrained),')']);
1065           end
1066           startval=DIVA('AuditoryCortexCategorical','match')+2;
1067         else
1068           for n=1:length(varargin{indexargin+1})
1069             targmenu{n+1}=sprintf('%s\t%s',varargin{indexargin+1}(n).label,...
1070                                 ['(',num2str(varargin{indexargin+1}(n).ntrained),')']);
1071           end
1072           startval=1;
1073         end
1074         set(DIVA_GUI_data.private.model.menu.learned,'String',targmenu);
1075         set(DIVA_GUI_data.private.model.menu.learned,'value',startval);
1076         set(DIVA_GUI_data.private.model.menu.learned,'enable','on');
1077 
1078         
1079       else
1080         set(DIVA_GUI_data.private.model.menu.learned,'String','--No Targets--');
1081         set(DIVA_GUI_data.private.model.button.play,'enable','off');
1082       end
1083 
1084       %--------------------------------------------------------------%
1085 
1086      case 'other_weights',
1087       oreps={'motor','auditory','somatosensory','motor_weight',...
1088              'somatosensory_weight'...
1089              'error_auditory','error_somatosensory'};
1090       if(nargin>=indexargin+1 && isempty(varargin{indexargin+1}))
1091         curr_plot = get(DIVA_GUI_data.private.model.menu.other,'value');
1092       else,
1093         if(DIVA_GUI_data.params.act_plot == ...
1094            strmatch(varargin{indexargin+1},oreps,'exact'))
1095           curr_plot = DIVA_GUI_data.params.act_plot;
1096         else
1097           curr_plot =[];
1098         end
1099       end
1100       if(~isempty(curr_plot))
1101         DIVA_GUI_data.params.act_plot=curr_plot;
1102       end
1103       maxModeDim=size(DIVA_GUI_data.private.model.traces.other,1);
1104       searchIdx=DIVA('TimeStep')*(-1000:0);
1105       switch(DIVA_GUI_data.params.act_plot)
1106        case 1, % Motor Activity
1107         searchTarg=DIVA('MotorCortex','target',[],searchIdx);
1108         idx=getQueueIdx(searchTarg);
1109         motor=DIVA('VocalTract','motor',[],DIVA('TimeStep')*(-idx:0));
1110         targ = searchTarg(1000-idx+1:end);
1111         [targ motor]=chompIdx(targ,motor);
1112 
1113         if(~isempty(motor) && (mod(length(targ),DIVA('PlotStep'))==0 || ...
1114                               ~any(DIVA('busy'))))
1115           set(DIVA_GUI_data.private.model.guiaxes.other,'ylim',[0 1],...
1116                             'xlim',[min(targ) min(targ)+DIVA('AuditoryCortexCategorical','ntimepoints')]);
1117           plotReps(DIVA_GUI_data.private.model.traces.other,...
1118                    maxModeDim,DIVA('MotorCortex','nMotor'),...
1119                    targ,motor);
1120         end
1121         DIVA_GUI_data.params.act_plot = 1;
1122 
1123        case 2, % Auditory Signal
1124         searchTarg=DIVA('AuditoryCortex','target',[],searchIdx);
1125         idx=getQueueIdx(searchTarg);
1126         aurep=DIVA('AuditoryCortex','sound',[],DIVA('TimeStep')*(-idx:0));
1127         targ =searchTarg(1000-idx+1:end);
1128         [targ,aurep]=chompIdx(targ,aurep);
1129 
1130         if(~isempty(aurep) && (mod(length(targ),DIVA('PlotStep'))==0 || ...
1131                               ~any(DIVA('busy')))),
1132           set(DIVA_GUI_data.private.model.guiaxes.other,'ylim',[0 3500],...
1133                             'xlim',[min(targ) min(targ)+DIVA('AuditoryCortexCategorical','ntimepoints')]);
1134           plotReps(DIVA_GUI_data.private.model.traces.other,...
1135                    maxModeDim,DIVA('AuditoryCortex','nFormants'),...
1136                    targ,aurep);
1137         end
1138         DIVA_GUI_data.params.act_plot = 2;
1139 
1140        case 3, % Somatosensory Activity
1141         searchTarg=DIVA('SomatosensoryCortex','target',[],searchIdx);
1142         idx=getQueueIdx(searchTarg);
1143         somato=DIVA('SomatosensoryCortex','somatosensory',[],...
1144                     DIVA('TimeStep')*(-idx:0));
1145         targ  =searchTarg(1000-idx+1:end);
1146         [targ,somato]=chompIdx(targ,somato);
1147 
1148         if(~isempty(somato) && (mod(length(targ),DIVA('PlotStep'))==0 || ...
1149                                ~any(DIVA('busy'))))
1150           set(DIVA_GUI_data.private.model.guiaxes.other,'ylim',[0 1],...
1151                             'xlim',[min(targ) min(targ)+DIVA('AuditoryCortexCategorical','ntimepoints')]);
1152           plotReps(DIVA_GUI_data.private.model.traces.other,...
1153                    maxModeDim,DIVA('SomatosensoryCortex','nSensory'),...
1154                    targ,somato);
1155         end
1156 
1157        case 4, % Motor Weights
1158         searchTarg=DIVA('MotorCortex','target',[],searchIdx);
1159         idx=getQueueIdx(searchTarg);
1160         targ =searchTarg(1000-idx+1:end);
1161 
1162         motor = DIVA('MotorCortex','WeightsFromTargets');
1163         if(~isempty(motor) && DIVA('AuditoryCortexCategorical','match')~=-1 && ...
1164            (mod(length(targ),DIVA('PlotStep'))==0 || ~any(DIVA('busy'))))
1165           matchstart=DIVA('AuditoryCortexCategorical','match')*...
1166               DIVA('AuditoryCortexCategorical','ntimepoints')+1;
1167           matchend=matchstart+DIVA('AuditoryCortexCategorical','ntimepoints')-1;
1168           set(DIVA_GUI_data.private.model.guiaxes.other,'ylim',[0 1],...
1169                             'xlim',[matchstart matchend]);
1170           plotReps(DIVA_GUI_data.private.model.traces.other,...
1171                    maxModeDim,DIVA('MotorCortex','nMotor'),...
1172                    matchstart:matchend,motor(:,matchstart:matchend));
1173         end
1174         DIVA_GUI_data.params.act_plot = 4;
1175 
1176        case 5, % Somatosensory Weights
1177         searchTarg=DIVA('MotorCortex','target',[],searchIdx);
1178         idx=getQueueIdx(searchTarg);
1179         targ =searchTarg(1000-idx+1:end);
1180         somatorep=DIVA('SomatosensoryCortex','WeightsFromTargets');
1181         if(~isempty(somatorep) && DIVA('AuditoryCortexCategorical','match')~=-1 && ...
1182            (mod(length(targ),DIVA('PlotStep'))==0 || ~any(DIVA('busy'))))
1183           matchstart=DIVA('AuditoryCortexCategorical','match')*...
1184               DIVA('AuditoryCortexCategorical','ntimepoints')+1;
1185           matchend=matchstart+DIVA('AuditoryCortexCategorical','ntimepoints')-1;
1186           set(DIVA_GUI_data.private.model.guiaxes.other,'ylim',[0 1],...
1187                             'xlim',[matchstart matchend]);
1188           plotReps(DIVA_GUI_data.private.model.traces.other,...
1189                    maxModeDim,DIVA('SomatosensoryCortex','nSensory'),...
1190                    matchstart:matchend,somatorep(:,matchstart:matchend));
1191         end
1192         DIVA_GUI_data.params.act_plot = 5;
1193 
1194        case 6, % Acoustic Error
1195         searchTarg=DIVA('MotorCortex','target',[],searchIdx);
1196         idx=getQueueIdx(searchTarg);
1197         auerror=DIVA('MotorCortex','error_sound',[],DIVA('TimeStep')*(-idx:0));
1198         targ=searchTarg(1000-idx+1:end);
1199         [targ, auerror]=chompIdx(targ,auerror);
1200         if(~isempty(auerror) && (mod(length(targ),DIVA('PlotStep'))==0 || ...
1201                                 ~any(DIVA('busy'))))
1202           set(DIVA_GUI_data.private.model.guiaxes.other,'ylim',[-750 750],...
1203                             'xlim',[min(targ) min(targ)+DIVA('AuditoryCortexCategorical','ntimepoints')]);
1204           plotReps(DIVA_GUI_data.private.model.traces.other,...
1205                    maxModeDim,DIVA('AuditoryCortex','nFormants'),...
1206                    targ,auerror);
1207         end
1208         DIVA_GUI_data.params.act_plot = 6;
1209 
1210        case 7, % Somatosensory Error Weights
1211         searchTarg=DIVA('MotorCortex','target',[],searchIdx);
1212         idx=getQueueIdx(searchTarg);
1213         somatoerror=DIVA('MotorCortex','error_somatosensory',[],...
1214                          DIVA('TimeStep')*(-idx:0));
1215         targ=searchTarg(1000-idx+1:end);
1216         [targ, somatoerror]=chompIdx(targ,somatoerror);
1217 
1218         if(~isempty(somatoerror) && (mod(length(targ),DIVA('PlotStep'))==0 || ...
1219                                     ~any(DIVA('busy'))))
1220           set(DIVA_GUI_data.private.model.guiaxes.other,'ylim',[-1 1],...
1221                             'xlim',[min(targ) min(targ)+DIVA('AuditoryCortexCategorical','ntimepoints')]);
1222           plotReps(DIVA_GUI_data.private.model.traces.other,...
1223                    maxModeDim,DIVA('SomatosensoryCortex','nSensory'),...
1224                    targ,somatoerror);
1225         end
1226         DIVA_GUI_data.params.act_plot = 7;
1227       end
1228 
1229       if(~any(DIVA('busy')) || mod(length(targ),DIVA('PlotStep'))==0),
1230         set(DIVA_GUI_data.private.model.guiaxes.other,...
1231             'ButtonDownFcn',...
1232             {@gui_plot_align, DIVA_GUI_data.private.figurehandle})
1233       end
1234 
1235       %--------------------------------------------------------------%
1236 
1237      case 'VT_Configuration',
1238       set(DIVA_GUI_data.private.vocaltract.guiaxes.vtplot,'visible','on');
1239       axes(DIVA_GUI_data.private.vocaltract.guiaxes.vtplot);
1240       if(ischar(varargin{indexargin+1}) && strcmp(varargin{indexargin+1},'update'))
1241         for i=1:length(DIVA_GUI_data.private.data.artics)
1242           config(i,1)=...
1243               get(DIVA_GUI_data.private.vocaltract.slider.(DIVA_GUI_data.private.data.artics{i}),...
1244                   'value');
1245         end
1246         for i=1:length(DIVA_GUI_data.private.data.glot_label)
1247           config(i+8,1)=...
1248               get(DIVA_GUI_data.private.vocaltract.slider.(DIVA_GUI_data.private.data.glot_label{i}),...
1249                   'value');
1250         end
1251         DIVA('VocalTract','plot',config(1:8,1));
1252       elseif(isstruct(varargin{indexargin+1})),
1253         if(~isempty(varargin{indexargin+1}.configuration))
1254           DIVA('VocalTract','plot',varargin{indexargin+1}.configuration(1:8,1));
1255         else
1256           DIVA('VocalTract','plot',zeros(DIVA('VocalTract','nArtic'),1));
1257         end
1258       else
1259         DIVA('VocalTract','plot',varargin{indexargin+1});
1260       end
1261       axis tight;
1262 
1263       %--------------------------------------------------------------%
1264 
1265      case 'artic_edit',
1266       params=varargin{indexargin+1};
1267 
1268       if(isstruct(params))
1269         for i=1:length(params)
1270           set(DIVA_GUI_data.private.vocaltract.edit.(params(i).name),...
1271               'string',sprintf('%1.2f',params(i).value));
1272         end
1273       else
1274         if(length(params)==length(DIVA_GUI_data.private.data.artics)),
1275           artics=DIVA_GUI_data.private.data.artics;
1276           for i=1:length(DIVA_GUI_data.private.data.artics),
1277             set(DIVA_GUI_data.private.vocaltract.edit.(artics{i}),...
1278                 'string',sprintf('%1.2f',params(i)));
1279           end
1280         end
1281       end
1282 
1283       %--------------------------------------------------------------%
1284 
1285      case 'artic_slider',
1286       params=varargin{indexargin+1};
1287       if(~nargout)
1288         if(isstruct(params))
1289           for i=1:length(params)
1290             set(DIVA_GUI_data.private.vocaltract.slider.(params(i).name),...
1291                 'value',params(i).value);
1292           end
1293         else
1294           if(length(params)==length(DIVA_GUI_data.private.data.artics)),
1295             artics=DIVA_GUI_data.private.data.artics;
1296             for i=1:length(DIVA_GUI_data.private.data.artics),
1297               set(DIVA_GUI_data.private.vocaltract.slider.(artics{i}),...
1298                   'value',params(i));
1299             end
1300           end
1301         end
1302       else
1303         if(isempty(params))
1304           params=DIVA_GUI_data.private.data.artics;
1305         end
1306         for i=1:length(params)
1307           out(i,1)=get(DIVA_GUI_data.private.vocaltract.slider.(params{i}),...
1308                        'value');
1309         end
1310       end
1311 
1312       %--------------------------------------------------------------%
1313 
1314      case 'glot_slider',
1315       params=varargin{indexargin+1};
1316       if(nargout)
1317         for i=1:length(params)
1318           out(i,1)=get(DIVA_GUI_data.private.vocaltract.slider.(params{i}),...
1319                        'value');
1320         end
1321       end
1322 
1323       %--------------------------------------------------------------%
1324 
1325      case 'auTarget'
1326       set(DIVA_GUI_data.private.model.label.target_file,'UserData',...
1327                         [varargin{indexargin+1}.pathname,...
1328                          varargin{indexargin+1}.filename]);
1329       set(DIVA_GUI_data.private.model.label.target_file,...
1330           'string',sprintf('%s',varargin{indexargin+1}.filename));
1331       DIVA('GUI','current_file',...
1332            [varargin{indexargin+1}.pathname,...
1333             varargin{indexargin+1}.filename]);
1334       set(DIVA_GUI_data.private.model.button.acquire,'enable','on');
1335 
1336       %--------------------------------------------------------------%
1337 
1338      case 'VTControl',
1339       if(isempty(varargin{indexargin+1}))
1340         aue=get(DIVA_GUI_data.private.guimenu.prefs.control.fmt,'checked');
1341         vte=get(DIVA_GUI_data.private.guimenu.prefs.control.artic,'checked');
1342 
1343         fnames=fieldnames(DIVA_GUI_data.private.auditory.edit);
1344         for i=1:length(fnames)
1345           set(DIVA_GUI_data.private.auditory.edit.(fnames{i}),'enable',aue);
1346         end
1347         set(DIVA_GUI_data.private.auditory.button.go,'enable',aue);
1348 
1349         fnames=fieldnames(DIVA_GUI_data.private.vocaltract.edit);
1350         for i=1:length(fnames)
1351           set(DIVA_GUI_data.private.vocaltract.edit.(fnames{i}),'enable',vte);
1352         end
1353         fnames=fieldnames(DIVA_GUI_data.private.vocaltract.slider);
1354         for i=1:length(fnames)
1355           if(strcmp(get(DIVA_GUI_data.private.vocaltract.slider.(fnames{i}),'tag'),'slider'))
1356             set(DIVA_GUI_data.private.vocaltract.slider.(fnames{i}),'enable',vte);
1357           end
1358         end
1359       end
1360 
1361       %--------------------------------------------------------------%
1362       
1363      case 'VTAction',
1364       if(strcmp(varargin{indexargin+1},'enable'))
1365         enablestring='on';
1366       else
1367         enablestring='off';
1368       end
1369       set(DIVA_GUI_data.private.vocaltract.button.generate,'enable',enablestring);
1370       set(DIVA_GUI_data.private.vocaltract.button.learn,'enable',enablestring);
1371       
1372       %--------------------------------------------------------------%
1373 
1374      case 'play',
1375       set(DIVA_GUI_data.private.model.button.play,'enable',varargin{indexargin+1});
1376       set(DIVA_GUI_data.private.guimenu.file.export.sound,...
1377           'enable',varargin{indexargin+1});
1378       set(DIVA_GUI_data.private.guimenu.file.export.movie,...
1379           'enable',varargin{indexargin+1});
1380       %--------------------------------------------------------------%
1381 
1382      case 'produce',
1383       set(DIVA_GUI_data.private.model.button.produce,...
1384           'enable',varargin{indexargin+1});
1385 
1386       %--------------------------------------------------------------%
1387 
1388      case 'save',
1389       SessionFolder=strcat(DIVA('SessionFolder'),filesep);
1390       if nargin<indexargin+1,
1391         initfile=[SessionFolder,'Session_','default',filesep,mfilename,'.mat'];
1392       else,
1393         initfile=[SessionFolder,'Session_',varargin{indexargin+1},...
1394                   filesep,mfilename,'.mat'];
1395       end
1396       params=DIVA_GUI_data.params;
1397       save(initfile,'params');
1398 
1399       %--------------------------------------------------------------%
1400 
1401      case 'disp',
1402       gfields=fieldnames(DIVA_GUI_data.params);
1403       for i=1:length(gfields)
1404         disp(['---',gfields{i}]);
1405         disp(DIVA_GUI_data.params.(gfields{i}));
1406       end
1407 
1408       %--------------------------------------------------------------%
1409 
1410      case 'exit',
1411       if ishandle(DIVA_GUI_data.private.figurehandle),
1412         set(DIVA_GUI_data.private.figurehandle,'deletefcn','');
1413         delete(DIVA_GUI_data.private.figurehandle);
1414       end
1415       clear DIVA_GUI_data;
1416       disp([mfilename, ' : Exiting session...']);
1417 
1418       % CODE FOR CLEARING MEMORY OR THE LIKE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1419       % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1420 
1421       % CODE IMPLEMENTING THIS MODULE PROCESS(ES) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1422       % Note: use DIVA(ModuleName,ChannelName,data,delay) to comunicate with other
1423       %       DIVA modules
1424       % case 'ChannelName1',
1425       % case 'ChannelName2',
1426 
1427       % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1428 
1429      otherwise,
1430       if isfield(DIVA_GUI_data.params,varargin{indexargin}),
1431         if indexargin==nargin,
1432           out=DIVA_GUI_data.params.(varargin{indexargin});
1433         else,
1434           DIVA_GUI_data.params.(varargin{indexargin})=varargin{indexargin+1};
1435         end
1436       else,
1437         warning('DIVA_GUI: wrong argument');
1438       end
1439     end
1440   end
1441 
1442 function plotReps(handles,maxModeDim,curDim,targ,rep)
1443   lo={'-','--'};
1444   co=get(get(handles(1),'parent'),'colororder');
1445   for n=1:maxModeDim,
1446     if(n<=curDim),
1447       set(handles(n),'Xdata',targ,'Ydata',rep(n,:),'visible','on',...
1448                      'buttondownfcn',@gui_plot_align);
1449       if(curDim>DIVA('AuditoryCortex','nFormants') && ...
1450          n<=DIVA('MotorCortex','nMotor')),
1451         set(handles(n),'linestyle',lo{mod(n,2)+1});
1452         if(mod(n,2)==0)
1453           set(handles(n),'color',co(mod(n-1,11)+1,:));
1454         else
1455           set(handles(n),'color',co(mod(n,11)+1,:));
1456         end
1457       else,
1458         set(handles(n),'linestyle',lo{1},'color',co(mod(n,11)+1,:));
1459       end
1460     else
1461       set(handles(n),'visible','off');
1462     end
1463   end

Generated on Tue 27-Mar-2007 12:06:24 by m2html © 2003