time = linspace(-1, 1, N);
frames = cat(4,zeros([size(codeAlpha),numChannels,bufferSize]));
for i = 1:length(time)
    frames(:,:,:,i) = codeAlpha.*time(:,:,:,i) + codeAlpha.*(1-time(:,:,:,i))*(-1);
    ...
 What you trying to do here?
You've defined time as a vector of 100 points over range -1:1 but then try to reference it by a 4-D vector.  That will return the whole thing by dimensions collapsing.
Look at the following minimal example that is small-enough and clean-enough to be able to visualize what's going on as outline...
B=ones(2,3,3,3);                % a trivially easy buffer array of three frames
t=linspace(-1,1,size(B,4));     % your weighting time vector sized on B to work in place
for i=1:numel(t),B(:,:,:,i)=B(:,:,:,i)*t(i);end % apply the weight -- other side is obvious
% show resulting B
>> B(:,:,:,1)
ans(:,:,1) =
    -1    -1    -1
    -1    -1    -1
ans(:,:,2) =
    -1    -1    -1
    -1    -1    -1
ans(:,:,3) =
    -1    -1    -1
    -1    -1    -1
>> B(:,:,:,2)
ans(:,:,1) =
     0     0     0
     0     0     0
ans(:,:,2) =
     0     0     0
     0     0     0
ans(:,:,3) =
     0     0     0
     0     0     0
>> B(:,:,:,3)
ans(:,:,1) =
     1     1     1
     1     1     1
ans(:,:,2) =
     1     1     1
     1     1     1
ans(:,:,3) =
     1     1     1
     1     1     1
>> 
% Show problem of wrong addressing for the time vector...
>> t(:,:,:,1)
ans =
    -1     0     1
>> 


