## Author: Jan
## Created: 2016-11-09

function [retval] = preprocessingData ()
  #data selection for training and testing year
  dataFile = fopen("omni2_24739.lst.txt");
  trainFile = fopen("trainingYear2005.txt", "a");
  testFile = fopen("testingYear2008.txt", "a");

  trainingYear = "2005";
  testingYear = "2008";

  nullValue = "999.9";

  while(!feof(dataFile))
    line = fgetl(dataFile);
    
    if (size(strfind(line, nullValue)) == 0)  
      if (any(strfind(line, trainingYear)) == 1)
        fprintf(trainFile, "%s%s", line, "\n");
      endif
      if (any(strfind(line, testingYear)) == 1)
        fprintf(testFile, "%s%s", line, "\n");
      endif
    endif  
  endwhile

  fclose(dataFile);
  fclose(trainFile);
  fclose(testFile);
endfunction
