function [Time, Extension, Load] = importtensiledata(filename, dataLines) %IMPORTFILE Import data from a text file % [TIME, EXTENSION, LOAD] = IMPORTTENSILEDATA(FILENAME) reads data from text % file FILENAME for the default selection. Returns the data as column % vectors. % % [TIME, EXTENSION, LOAD] = IMPORTTENSILEDATA(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: % [Time, Extension, Load] = importtensiledata("D:\Parachute_Cord_tensile\Specimen_RawData_6_cord1_bowline.csv", [3, Inf]); % % See also READTABLE. % % Auto-generated by MATLAB on 29-Apr-2023 12:40:34 %% Input handling % If dataLines is not specified, define defaults if nargin < 2 dataLines = [3, Inf]; end %% Set up the Import Options and import the data opts = delimitedTextImportOptions("NumVariables", 3); % Specify range and delimiter opts.DataLines = dataLines; opts.Delimiter = ","; % Specify column names and types opts.VariableNames = ["Time", "Extension", "Load"]; opts.VariableTypes = ["double", "double", "double"]; % Specify file level properties opts.ExtraColumnsRule = "ignore"; opts.EmptyLineRule = "read"; % Import the data tbl = readtable(filename, opts); %% Convert to output type Time = tbl.Time; Extension = tbl.Extension; Load = tbl.Load; end