%% Make KML path file from CSV file

% Column A = Latitude
% Column B = Longitude
% No headers

clear all;
[filename,pathname,FilterIndex] = uigetfile('S:\nistcontrols\alines\Robot\Log Files\*.csv','Choose Coordinate CSV File');
delimiter = ',';
name=[pathname filename];

formatSpec = '%s%f%f%f%[^\n\r]';
fileID = fopen(name,'r');
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'EmptyValue' ,NaN, 'ReturnOnError', false);
fclose(fileID);

latlon(:,1)= dataArray{:,2};
latlon(:,2)= dataArray{:,3};

newfile = strrep(filename, '.csv', '');

kmlpathwrite(pathname,newfile,latlon);




