function [ data_out] = f_remove_cp2( data_in, RB_symb,...
                    N_fft, cp_1st, cp_oth, del_f )
%UNTITLED Summary of this function goes here
%   

  if del_f == 15
    n = 7;
  elseif del_f == 30
    n = 14;
  elseif del_f == 60
    n = 28;
  elseif del_f == 120
    n = 56;
  elseif del_f == 240
    n = 128;
  end

  data_sub = data_in;
  i = 0;
  cp = cp_1st;
  idx_start = cp+1;
  idx_stop = cp+N_fft;
  data_mx = zeros(RB_symb, N_fft);
  
  %while(cp+N_fft)
  while((idx_stop) <= length(data_sub))
%     data_mx(i+1,:) = data_sub(1, cp+1:cp+N_fft);
%     data_sub = data_sub(1, cp+N_fft+1:end);
    data_mx(i+1,:) = data_sub(1, idx_start:idx_stop);

    i = i+1;
    
    if mod(i,n) == 0
      cp = cp_1st;
    else
      cp = cp_oth;
    end
    
    idx_start = idx_start + (N_fft+cp);
    idx_stop = idx_stop + (N_fft+cp);
    
  end
  
  %if cp+N_fft
  if(idx_stop) > length(data_sub)
    data_mx_remain = data_sub(1, idx_start:end);
  end

  data_out = [reshape(data_mx',1, numel(data_mx)), data_mx_remain];
  
%   %Convert into matrix for better insert of CP
%   data_resh = reshape(data_in, length(data_in)/N_fft, N_fft);
%   data_resh = data_resh';
%   
%   %number of rows
%   row_num = length(data_resh(:,1))
%   
%   
%   
%   %Inserting of first CP
%   M_cp(1,:) = [data_resh(1,((end-cp_1st+1):end)),data_resh(1,:)];
%   data_out = M_cp(1,:);
%   %data_out(1,1:N_fft+cp_1st) = M_cp(1,:);
%   for i=1:1:row_num-1
%     
%     if mod(i,n) == 0
%       M_cp(i+1,:) = [data_resh(i+1,((end-cp_1st+1):end)),data_resh(i+1,:)];
%       data_out = [data_out, M_cp(i+1,:)];
%       %data_out(1,(((i-1)*N_fft)+cp_1st+1):((i*N_fft)+cp_1st)) = M_cp(i+1,:);
%     else
%       M_cp(i+1,:) = [data_resh(i+1,((end-cp_oth+1):end)),data_resh(i+1,:), zeros(1,(cp_1st-cp_oth))];
%       M_cp_nozero = [data_resh(i+1,((end-cp_oth+1):end)),data_resh(i+1,:)];
%       data_out = [data_out, M_cp_nozero];
%       %data_out(1,(i-1)*N_fft+cp_oth+1:i*N_fft+cp_oth) = M_cp(i+1,1:end-(cp_1st-cp_oth));
%     end
% 
%   end
% 
%   data_matrix = M_cp;
 end


