%strength of connections within assemblies, to adjust pE=25; %number of connections one E assembly neurons receives from other E assembly neurons pI=13; %number of connections one E assembly neurons receives from I assembly neurons pEI=25; %number of connections one I assembly neurons receives from E assembly neurons (for tuned I, set to 0) tit=0; for matlist=1:20 num_pat=15; % number of assemblies (memories), can be changed num_exc=100; % E assembly size, can be changed num_inh=25; % I assembly size, can be changed num_ob=150; load(strcat('connec_A_',num2str(matlist),'.mat')) %name of the random connectivity matrix WE_rand=w_ee; WEI_rand=w_ei; WIE_rand=w_ie; load('odorseqD21_poisson.mat','OBinp') %OB input EnsE=[]; Ee=zeros(num_pat,num_exc); pat_inc=1; TOT=[1:4000]; a=1; for od=1:num_pat act_mc=OBinp(od,1:num_ob,1); %activated mitral cells which define odor od (150 cells with the highest firing rate) OB=[]; [E_temp_l1 id_l1]=sort(sum(w_oe(act_mc(1:num_ob),:),1)); num_conn=E_temp_l1(4000-num_exc+1); id_l1=id_l1(E_temp_l1>=num_conn); id_l1=id_l1(randperm(length(id_l1))); Ee(od,:)=id_l1(1:num_exc); Eout(od,:)=TOT(~ismember(TOT,Ee(od,:))); EnsE=[EnsE;Ee(od,:)']; for ke=1:length(Ee) ens_r=find(w_ee(Ee(od,:),Ee(od,ke))>0); noens_r=find(w_ee(Eout(od,:),Ee(od,ke))==1); if length(ens_r)=num_conn_I); id_i=id_i(randperm(length(id_i))); Ii(od,:)=id_i(1:num_inh); TOTI=[1:1000]; %FB Iout(od,:)=TOTI(~ismember(TOTI,Ii(od,:))); EnsI=[EnsI;Ii(od,:)']; for ke=1:length(Ee) ens_rI=find(w_ie(Ii(od,:),Ee(od,ke))>0); noens_rI=find(w_ie(Iout(od,:),Ee(od,ke))==1); if length(ens_rI)0); noens_rI=find(w_ei(Eout(od,:),Ii(od,ki))==1); if length(ens_rI)