-
Notifications
You must be signed in to change notification settings - Fork 0
/
PacketRawDataConversion.m
executable file
·33 lines (25 loc) · 1.1 KB
/
PacketRawDataConversion.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
%-------------------------JONATHAN TOBIAS DA SILVA-------------------------
%----------------------ENGENHARIA ELÉTRICA - 1ª TURMA----------------------
%------------------INSTITUTO FEDERAL- CAMPUS SERTÃOZINHO-------------------
%--------------------------------------------------------------------------
%--------------------INICIAÇÃO - DIAGNÓSTICO DE FALHAS---------------------
%--------------------------------------------------------------------------
function ret = PacketRawDataConversion(packetRawData)
%Obtém tamanho do vetor
tam = size(packetRawData);
%Converte os dados separados por , em array individuais
tam = tam(1);
for i = 1:tam
packetRawDataS{i} = strsplit(packetRawData{i},',');
end;
clear packetRawData;
%Converte os valores para inteiro (facilitar o processamento dos bytes)
for i = 1:tam
%packetRawData{i} = uint8(hex2dec(packetRawDataS{i}));
packetRawData{i} = uint8(str2double(packetRawDataS{i}));
end;
%faz a tranposição do vetor
packetRawData = packetRawData';
%apaga variáveis auxiliares da memória
clear packetRawDataS tam i;
ret = packetRawData;