Okay, as I read my own question i realized that I was quite far from the optimal method. My new code is like this
for m = scales
    for n = 0:99
        tScale = 2^(m-1);  % Time scale factor: 2, 4, 8, 16...
        tShift = 0.01*n*tScale; % Time shift factor [s]
          % Calculate the scaled and shiftet wavlet
          wavelet = (1./(1+(tScale*t-tShift).^4)).*cos(20*(tScale*t-tShift));
          % Calculate lag zero crosscorrelaton
          zeroCorr = signal*wavelet';
          % Insert into coefficient matrix
          coefs(m,n+1) = zeroCorr; 
      end
  end
Scales is equal to 1:10 and n is just the time delay. Can someone tell me if this is correct? It seem to create the correct signals.

