-
Notifications
You must be signed in to change notification settings - Fork 1
/
ImportExcelData.m
48 lines (40 loc) · 2.12 KB
/
ImportExcelData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
%% Import data from text file
% Script for importing data from the following text file:
%
% filename: \\win.bsh.de\root$\Standard\Hamburg\Homes\Homes00\bm2286\ICE\202105_Romain\CompleteExport_GPS_fix0_20210416.txt
%
% Auto-generated by MATLAB on 05-May-2021 07:03:18
%% Setup the Import Options and import the data
opts = delimitedTextImportOptions("NumVariables", 14);
% Specify range and delimiter
opts.DataLines = [2, Inf];
opts.Delimiter = "\t";
% Specify column names and types
opts.VariableNames = ["PLATFORM_CODE", "CV_NUMBER", "LONGITUDE", "LATITUDE", "STATION_DATE", "PLATFORM_TYPE", "DAC", "FIRMWARE_VERSION", "TECH_FLAG_ICEDETECTION_NUMBER", "ICEALGORITHMACTIVATED_LOGICAL", "TRANSMISSIONDELAYED_NUMBER", "YEAR", "MONTH", "DAY"];
opts.VariableTypes = ["double", "double", "double", "double", "datetime", "categorical", "categorical", "categorical", "string", "string", "string", "double", "double", "double"];
% Specify file level properties
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
% Specify variable properties
opts = setvaropts(opts, ["TECH_FLAG_ICEDETECTION_NUMBER", "ICEALGORITHMACTIVATED_LOGICAL", "TRANSMISSIONDELAYED_NUMBER"], "WhitespaceRule", "preserve");
opts = setvaropts(opts, ["PLATFORM_TYPE", "DAC", "FIRMWARE_VERSION", "TECH_FLAG_ICEDETECTION_NUMBER", "ICEALGORITHMACTIVATED_LOGICAL", "TRANSMISSIONDELAYED_NUMBER"], "EmptyFieldRule", "auto");
opts = setvaropts(opts, "STATION_DATE", "InputFormat", "");
% Import the data
tbl = readtable("\\win.bsh.de\root$\Standard\Hamburg\Homes\Homes00\bm2286\ICE\202105_Romain\CompleteExport_GPS_fix0_20210416.txt", opts);
%% Convert to output type
PLATFORM_CODE = tbl.PLATFORM_CODE;
CV_NUMBER = tbl.CV_NUMBER;
LONGITUDE = tbl.LONGITUDE;
LATITUDE = tbl.LATITUDE;
STATION_DATE = tbl.STATION_DATE;
PLATFORM_TYPE = tbl.PLATFORM_TYPE;
DAC = tbl.DAC;
FIRMWARE_VERSION = tbl.FIRMWARE_VERSION;
TECH_FLAG_ICEDETECTION_NUMBER = tbl.TECH_FLAG_ICEDETECTION_NUMBER;
ICEALGORITHMACTIVATED_LOGICAL = tbl.ICEALGORITHMACTIVATED_LOGICAL;
TRANSMISSIONDELAYED_NUMBER = tbl.TRANSMISSIONDELAYED_NUMBER;
YEAR = tbl.YEAR;
MONTH = tbl.MONTH;
DAY = tbl.DAY;
%% Clear temporary variables
clear opts tbl