You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DriversModulators/define_input_with_cutoff_an...

34 lines
1.0 KiB
Matlab

function X=define_input_with_cutoff_and_attn(I,nTrials,nFBchannels,Amasks,Acoords,offTime,iterations);
%the first two channels are the ff input from the LGN
for trial=1:nTrials
if iscell(I)
X{trial}=preprocess_V1_input(I{trial});
else
%use same image for each trial type
X{trial}=preprocess_V1_input(I);
end
end
nFFchannels=length(X{1});
%the remaining channels are the top-down, attentional, inputs
[a,b]=size(X{1}{1});
for trial=1:nTrials
for i=1:nFBchannels
X{trial}{nFFchannels+i}=zeros(a,b,'single');%set all top-down inputs to zero
end
for j=1:length(Amasks{trial})
X{trial}{nFFchannels+Amasks{trial}(j)}(Acoords{trial}(j,1),Acoords{trial}(j,2))=0.5;%give values to specific top-down inputs
end
end
%define input to have a finite duration: it goes to zero after some time
if offTime<iterations
for trial=1:nTrials
for channel=1:nFFchannels+nFBchannels
for t=2:offTime
X{trial}{channel}(:,:,t)=X{trial}{channel}(:,:,1);
end
X{trial}{channel}(:,:,t+1)=zeros(a,b,'single');
end
end
end