function tiksoiltwr = importsoiltwr(filename, dataLines)
%IMPORTFILE Import data from a text file
%  TIKSOILTWR = IMPORTFILE(FILENAME) reads data from text file FILENAME
%  for the default selection.  Returns the numeric data.
%
%  TIKSOILTWR = IMPORTFILE(FILE, DATALINES) reads data for the specified
%  row interval(s) of text file FILENAME. Specify DATALINES as a
%  positive scalar integer or a N-by-2 array of positive scalar integers
%  for dis-contiguous row intervals.
%
%  Example:
%  tiksoiltwr = importfile("X:\tiksi\surface_properties\fluxtower\towermet\products\2018\tiksoiltwr.b1.20180100.000000.txt", [2, Inf]);
%
%  See also READTABLE.
%
% Auto-generated by MATLAB on 18-Jul-2021 16:38:36

%% Input handling

% If dataLines is not specified, define defaults
if nargin < 2
    dataLines = [2, Inf];
end

%% Setup the Import Options and import the data
opts = delimitedTextImportOptions("NumVariables", 20);

% Specify range and delimiter
opts.DataLines = dataLines;
opts.Delimiter = "\t";

% Specify column names and types
opts.VariableNames = ["DayFracYearJulianDayHourMinFluxPlateAWm2FluxPlateBWm2SurfHeight", "VarName2", "VarName3", "VarName4", "VarName5", "VarName6", "VarName7", "VarName8", "VarName9", "VarName10", "VarName11", "VarName12", "VarName13", "VarName14", "VarName15", "VarName16", "VarName17", "VarName18", "VarName19", "VarName20"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double"];

% Specify file level properties
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";

% Import the data
tiksoiltwr = readtable(filename, opts);

%% Convert to output type
tiksoiltwr = table2array(tiksoiltwr);
tiksoiltwr(tiksoiltwr==-9999) = NaN;
end