forked from dushenda/MATLAB-Serial-Communication
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bytes.m
29 lines (28 loc) · 826 Bytes
/
bytes.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
function bytes(obj,~,handles)
str = fgetl(obj);
oldData = get(handles.tblShowData,'Data');
% 正则表达式分割数组
strCell = regexp(str,',','split');
Start = strCell{1};
Address = getAddressCode(strCell{2});
[PositionLatStr,~] = getLatitude(strCell{3});
[PositionLonStr,~] = getLongitude(strCell{4});
myTime = datestr(getTime(strCell{5}));
TriggerTime = getTriggerTime(strCell{6});
Power = getPower(strCell(7));
Stop = strCell{8};
if (strcmp(Stop(1:4),'STOP') && strcmp(Start,'START'))
Iffull = '完整';
Stop = 'STOP';
else
Iffull = '不完整';
end
add = '';
% 添加数组数据进表格
newRow = {Start,Address,PositionLatStr,PositionLonStr,myTime,...
TriggerTime,Power,Stop,Iffull,add};
newData = [oldData; newRow];
% 输入数据进行排序
newData = sortrows(newData,2,'descend');
set(handles.tblShowData,'Data',newData);
end