0001 contents = what('Sessiontargets/Session_default');
0002 files = contents.mat;
0003 maxTrain=7;
0004 for n=1:length(files)
0005 disp(files{n});
0006 end
0007
0008 DIVA('init','default');
0009
0010 for n=1:length(files),
0011 target=load(['Sessiontargets/Session_default/',files{n}]);
0012 DIVA('SoundChannel','sound',target.f.mean');
0013 DIVA('AuditoryCortexCategorical','label',target.name);
0014 DIVA('simulate');
0015 iter=1;
0016
0017 h=waitbar(iter/maxTrain,sprintf('%d Iterations',iter));
0018 while(iter<maxTrain)
0019 iter=iter+1;
0020 DIVA('AuditoryCortexCategorical','target',target.name);
0021 DIVA('simulate');
0022 waitbar(iter/maxTrain,h,sprintf('%d Iterations',iter));
0023 end
0024 au=DIVA('AuditoryCortex','sound',[],DIVA('TimeStep')*(-1000:0));
0025 da=DIVA('MotorCortex','error_sound',[],DIVA('TimeStep')*(-1000:0));
0026 if(~isempty(au) & ~isempty(da))
0027 figure('name',['Sound: ',target.name],'numbertitle','off');
0028 subplot(2,1,1),plot(au');
0029 subplot(2,1,2),plot(da');
0030 end
0031 close(h);
0032
0033 [y,fs,motor]=getSynthSound(target.name);
0034 produceMovie(y,fs,motor,target.name);
0035 clear('target');
0036 DIVA('save');
0037 end