
function [Idata_all,Qdata_all]=dataFile(param)
   
%% READ csvFILE
    addpath('../');
    readFile = readmatrix('Rawdata_14.csv');

    readFile_antenna1 = readFile(1,:);

    fileID_1 = fopen('Idataset.txt','w');
    fileID_2 = fopen('Qdataset.txt','w');
    
    for i=1:length(readFile_antenna1)
        fprintf(fileID_1,'%d\n',real(readFile_antenna1(i)));
        fprintf(fileID_2,'%d\n',imag(readFile_antenna1(i)));
    end

    fclose(fileID_1);
    fclose(fileID_2);

    [realData] = importdata(sprintf('Idataset.txt'));
    [imagData] = importdata(sprintf('Qdataset.txt'));


%% RESHAPE THE DATA for SWEllingson input
    
    counter = 0;
    for i=1:param.datalength    %datalength
        %counter = 0;
        for j=1:param.numSamplesperChirp*param.chirploops    %number of samples/2 chirps
            
            counter = counter+1;
            Idata_2D(i,j) = realData(counter);
            Qdata_2D(i,j) = imagData(counter);
    
        end
    
    end
    
    counter = 0;
    for i=1:param.datalength                     % datalength
    
        for j=1:param.numSamplesperChirp         % samples per chirp
          
            counter = counter+1;
            
            Idata_all(counter,1) = Idata_2D(i,j);
            Qdata_all(counter,1) = Qdata_2D(i,j);


        end
    end


%% PLOTTING Unbalanced I AND Q SIGNALS
    figure
    t = (0:length(Idata_all(1:param.numSamplesperChirp))-1)*param.numSamplesperChirp/length(Idata_all(1:param.numSamplesperChirp));
    plot(t,Idata_all(1:param.numSamplesperChirp)) 
    title("Unbalanced IQ signals")
    hold on
%     t = (0:length(Qdata_2D(1,:))-1)*param.numSamplesperChirp/length(Qdata_2D(1,:));
    plot(t,Qdata_all(1:param.numSamplesperChirp))
    xlabel("samples per chirp")
    ylabel("amplitude")
    legend('Idata','Qdata')

    hold off




%% Unbalanced I AND Q Constellation Diagram
    figure;
    plot(Idata_all, Qdata_all, 'r*');
    title("Unbalanced IQ Constellation diagram")
    xlabel('real part');
    ylabel('imaginary part');

%% Unbalanced I and Q signals FFT 


end