-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathais4.m
More file actions
33 lines (28 loc) · 1.35 KB
/
ais4.m
File metadata and controls
33 lines (28 loc) · 1.35 KB
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
function [ varString,outputData ] = ais4( binData )
% This function handles AIS message of type 4
%
% # input:
% - binData: 6-bit form binary payload data
%
% # output:
% - varString: Cell array containing AIS variable names
% - outputData: Cell array containing corresponing values
Message_Type = bin2dec(binData(1:6));
Repeat_Indicator = bin2dec(binData(7:8));
MMSI = bin2dec(binData(9:38));
YearUTC = bin2dec(binData(39:52));
MonthUTC = bin2dec(binData(53:56));
DayUTC = bin2dec(binData(57:61));
HourUTC = bin2dec(binData(62:66));
MinuteUTC = bin2dec(binData(67:72));
SecondUTC = bin2dec(binData(73:78));
Fix_quality = bin2dec(binData(79));
[Longitude,Latitude] = computeLatLonAIS( binData(80:134) );
Type_of_EPFD = bin2dec(binData(135:138));
Spare = bin2dec(binData(139:148));
RAIM_flag = bin2dec(binData(149));
SOTDMA_state = bin2dec(binData(150:168));
Report_Type = messageTypeString(Message_Type);
varString = {'Message_Type','Repeat_Indicator','MMSI','YearUTC','MonthUTC','DayUTC','HourUTC','MinuteUTC','SecondUTC','Fix_quality','Longitude','Latitude','Type_of_EPFD','Spare','RAIM_flag','SOTDMA_state','Report_Type'};
outputData = {Message_Type,Repeat_Indicator,MMSI,YearUTC,MonthUTC,DayUTC,HourUTC,MinuteUTC,SecondUTC,Fix_quality,Longitude,Latitude,Type_of_EPFD,Spare,RAIM_flag,SOTDMA_state,Report_Type};
end