%% Import data from text file.
% Script for importing data from the following text file:
%
%    D:\Data\STRATUS_2018\CabodeHornos\SCS\Raw\WXT__SMSAWS__20180405.txt
%
% To extend the code to different selected data or a different text file,
% generate a function instead of a script.

% Auto-generated by MATLAB on 2018/04/10 13:58:04

%% Initialize variables.
filename = 'D:\Data\STRATUS_2018\CabodeHornos\SCS\Raw\WXT__SMSAWS__20180405.txt';
delimiter = '\t';
startRow = 2;

%% Format string for each line of text:
%   column1: text (%q)
%	column2: double (%f)
%   column3: double (%f)
%	column4: double (%f)
%   column5: double (%f)
%	column6: text (%q)
%   column7: text (%q)
%	column8: text (%q)
%   column9: text (%q)
%	column10: text (%q)
%   column11: text (%q)
%	column12: text (%q)
%   column13: text (%q)
%	column14: text (%q)
%   column15: text (%q)
%	column16: text (%q)
%   column17: text (%q)
%	column18: text (%q)
%   column19: text (%q)
%	column20: text (%q)
%   column21: text (%q)
%	column22: text (%q)
%   column23: text (%q)
%	column24: text (%q)
%   column25: text (%q)
%	column26: text (%q)
%   column27: text (%q)
%	column28: text (%q)
%   column29: text (%q)
%	column30: text (%q)
%   column31: text (%q)
%	column32: text (%q)
%   column33: text (%q)
%	column34: text (%q)
%   column35: text (%q)
%	column36: text (%q)
%   column37: text (%q)
%	column38: text (%q)
%   column39: text (%q)
%	column40: text (%q)
%   column41: text (%q)
%	column42: text (%q)
%   column43: text (%q)
%	column44: text (%q)
%   column45: text (%q)
%	column46: text (%q)
%   column47: text (%q)
%	column48: text (%q)
%   column49: text (%q)
%	column50: text (%q)
%   column51: text (%q)
%	column52: text (%q)
%   column53: text (%q)
%	column54: text (%q)
%   column55: text (%q)
%	column56: text (%q)
%   column57: text (%q)
%	column58: text (%q)
%   column59: text (%q)
%	column60: text (%q)
%   column61: text (%q)
%	column62: text (%q)
%   column63: text (%q)
% For more information, see the TEXTSCAN documentation.
formatSpec = '%q%f%f%f%f%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%[^\n\r]';

%% Open the text file.
fileID = fopen(filename,'r');

%% Read columns of data according to format string.
% This call is based on the structure of the file used to generate this
% code. If an error occurs for a different file, try regenerating the code
% from the Import Tool.
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1, 'ReturnOnError', false);

%% Close the text file.
fclose(fileID);

%% Post processing for unimportable data.
% No unimportable data rules were applied during the import, so no post
% processing code is included. To generate code which works for
% unimportable data, select unimportable cells in a file and regenerate the
% script.

%% Allocate imported array to column variable names
TIME = dataArray{:, 1};
WS = dataArray{:, 2};
WD = dataArray{:, 3};
WSR = dataArray{:, 4};
WDR = dataArray{:, 5};
SC1TXT = dataArray{:, 6};
SC2TXT = dataArray{:, 7};
SC3TXT = dataArray{:, 8};
SC4TXT = dataArray{:, 9};
SC5TXT = dataArray{:, 10};
VarName11 = dataArray{:, 11};
VarName12 = dataArray{:, 12};
VarName13 = dataArray{:, 13};
VarName14 = dataArray{:, 14};
VarName15 = dataArray{:, 15};
VarName16 = dataArray{:, 16};
VarName17 = dataArray{:, 17};
VarName18 = dataArray{:, 18};
VarName19 = dataArray{:, 19};
VarName20 = dataArray{:, 20};
VarName21 = dataArray{:, 21};
VarName22 = dataArray{:, 22};
VarName23 = dataArray{:, 23};
VarName24 = dataArray{:, 24};
VarName25 = dataArray{:, 25};
VarName26 = dataArray{:, 26};
VarName27 = dataArray{:, 27};
VarName28 = dataArray{:, 28};
VarName29 = dataArray{:, 29};
VarName30 = dataArray{:, 30};
VarName31 = dataArray{:, 31};
VarName32 = dataArray{:, 32};
VarName33 = dataArray{:, 33};
VarName34 = dataArray{:, 34};
VarName35 = dataArray{:, 35};
VarName36 = dataArray{:, 36};
VarName37 = dataArray{:, 37};
VarName38 = dataArray{:, 38};
VarName39 = dataArray{:, 39};
VarName40 = dataArray{:, 40};
VarName41 = dataArray{:, 41};
VarName42 = dataArray{:, 42};
VarName43 = dataArray{:, 43};
VarName44 = dataArray{:, 44};
VarName45 = dataArray{:, 45};
VarName46 = dataArray{:, 46};
VarName47 = dataArray{:, 47};
VarName48 = dataArray{:, 48};
VarName49 = dataArray{:, 49};
VarName50 = dataArray{:, 50};
VarName51 = dataArray{:, 51};
VarName52 = dataArray{:, 52};
VarName53 = dataArray{:, 53};
VarName54 = dataArray{:, 54};
VarName55 = dataArray{:, 55};
VarName56 = dataArray{:, 56};
VarName57 = dataArray{:, 57};
VarName58 = dataArray{:, 58};
VarName59 = dataArray{:, 59};
VarName60 = dataArray{:, 60};
VarName61 = dataArray{:, 61};
VarName62 = dataArray{:, 62};
VarName63 = dataArray{:, 63};

yd_time= datenum(TIME(),1400);
yd_scs=yd_time-datenum(2018,04,05);   %Day-Of-Year
bd = 95+ yd_scs;
bds = num2str(bd);

figure

plot(bd ,SC1TXT{:,1},'b')  %Vaisala-Barometer-
ylabel('Pressure (hPa)');
xlabel('Year Day (UTC)')
title('Stratus 2018 Pressure');
grid
%xlim([ bd ed ]);
%ylim([ 1010 1020]);
legend('SCS','location','best');
 if prtit
 ppath = fullfile(path_images,[cruise,'_SCS_Pressure_',sprintf('%02i_%02i_%04i',scs(1,2),scs(1,3),scs(1,1)),graphformat]);
 print(graphdevice,ppath);
 end
%% Clear temporary variables
clearvars filename delimiter startRow formatSpec fileID dataArray ans;