-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAIS_decodeFile.m
More file actions
35 lines (28 loc) · 867 Bytes
/
AIS_decodeFile.m
File metadata and controls
35 lines (28 loc) · 867 Bytes
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
function [ dataAIS ] = AIS_decodeFile( fileAIS )
% This function decoded all AIS message and form AIS navigation reports
% that are stored in output file.
%
% # input:
% - fileAIS: AIS.txt file handle containing AIS messages
%
% # output:
% - dataAIS: Array of structures containing confirmed tracks
dataAIS = {};
counter = 1;
% Load the first message
tline = fgets(fileAIS);
while ischar(tline)
% disp(['Message: ' tline]);
reportAIS = AIS_decodeMessage(tline, fileAIS);
display('------------------------------------');
display(reportAIS)
if(strcmp(reportAIS.Report_Type,'No Decoder'))
tline = fgets(fileAIS);
continue;
end
dataAIS{counter} = reportAIS;
counter = counter + 1;
% Load the next message
tline = fgets(fileAIS);
end
end