function gt115 = importgt115(filename, dataLines) %IMPORTFILE Import data from a text file % GT115 = IMPORTFILE(FILENAME) reads data from text file FILENAME for % the default selection. Returns the data as a table. % % GT115 = 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: % gt115 = importfile("/home/lebars/Documents/Doctorate/codes/espic2d/geometries/gt115/gt115.data", [1, Inf]); % % See also READTABLE. % % Auto-generated by MATLAB on 08-Mar-2023 16:39:41 %% Input handling % If dataLines is not specified, define defaults if nargin < 2 dataLines = [1, Inf]; end %% Setup the Import Options and import the data opts = delimitedTextImportOptions("NumVariables", 6); % Specify range and delimiter opts.DataLines = dataLines; opts.Delimiter = " "; % Specify column names and types opts.VariableNames = ["txt", "cp", "Z", "R", "VarName5", "VarName6"]; opts.VariableTypes = ["categorical", "double", "double", "double", "double", "double"]; % Specify file level properties opts.ExtraColumnsRule = "ignore"; opts.EmptyLineRule = "read"; opts.ConsecutiveDelimitersRule = "join"; opts.LeadingDelimitersRule = "ignore"; % Specify variable properties opts = setvaropts(opts, "txt", "EmptyFieldRule", "auto"); % Import the data gt115 = readtable(filename, opts); end