-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathimportTime.m
49 lines (40 loc) · 2.82 KB
/
importTime.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
49
function Time = importTime(filename, dataLines)
%IMPORTFILE Import data from a text file
% Time = IMPORTFILE(FILENAME) reads data from text file FILENAME
% for the default selection. Returns the numeric data.
%
% Time = 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:
% Time = importfile("C:\Users\menzifr\Documents\3_My_SW\LEO_SPS\GINav-main(1)\GINav-main\data\LOWLEO_new\sat_data_V1A1.csv", [2, 2]);
%
% See also READTABLE.
%
% Auto-generated by MATLAB on 31-May-2024 00:10:22
%% Input handling
% If dataLines is not specified, define defaults
if nargin < 2
dataLines = [2, 2];
end
%% Set up the Import Options and import the data
opts = delimitedTextImportOptions("NumVariables", 55);
% Specify range and delimiter
opts.DataLines = dataLines;
opts.Delimiter = ",";
% Specify column names and types
opts.VariableNames = ["Time_ms", "Channel", "Sat_type", "Sat_ID", "Sat_PRN", "Echo_Num", "Sat_Pos_X", "Sat_Pos_Y", "Sat_Pos_Z", "Sat_Vel_X", "Sat_Vel_Y", "Sat_Vel_Z", "Azimuth", "Elevation", "Range", "PRangeGroupA", "PRangeGroupB", "PRangeGroupC", "PRangeGroupD", "PRangeGroupE", "PRangeGroupF", "PR_rate", "Iono_delayGroupA", "Iono_delayGroupB", "Iono_delayGroupC", "Iono_delayGroupD", "Iono_delayGroupE", "Iono_delayGroupF", "Tropo_delay", "PR_Error", "Signal_dBGroupA", "Signal_dBGroupB", "Signal_dBGroupC", "Signal_dBGroupD", "Signal_dBGroupE", "Signal_dBGroupF", "Ant_azimuth", "Ant_elevation", "Range_rate", "PR_Error_rate", "Doppler_shiftGroupA", "Doppler_shiftGroupB", "Doppler_shiftGroupC", "Doppler_shiftGroupD", "Doppler_shiftGroupE", "Doppler_shiftGroupF", "Delta_rangeGroupA", "Delta_rangeGroupB", "Delta_rangeGroupC", "Delta_rangeGroupD", "Delta_rangeGroupE", "Delta_rangeGroupF", "Sat_Acc_X", "Sat_Acc_Y", "Sat_Acc_Z"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double"];
% Specify file level properties
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
% Specify variable properties
opts = setvaropts(opts, "Sat_type", "TrimNonNumeric", true);
opts = setvaropts(opts, "Sat_type", "ThousandsSeparator", ",");
% Import the data
Time = readtable(filename, opts);
%% Convert to output type
Time = table2array(Time);
end