%% Import data from text file.
% Script for importing data from the following text file:
%
% VerticalSV.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/12/18 13:45:28
% last edited by Luyi Shen, Dec 18, 2018

filename = 'VerticalSV.txt';
delimiter = ' ';
startRow = 3;
formatSpec = '%f%f%f%f%f%*s%*s%*s%*s%[^\n\r]';
fileID = fopen(filename,'r');
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'MultipleDelimsAsOne', true, 'TextType', 'string', 'EmptyValue', NaN, 'HeaderLines' ,startRow-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');
fclose(fileID);
VerticalSV = table(dataArray{1:end-1}, 'VariableNames', {'Lat','Lon','Dep','SV','Uncertainty'});
clearvars filename delimiter startRow formatSpec fileID dataArray ans;