SP = serial( 'COM5', ...
    'BaudRate',9600, ...
    'Parity','none', ...
    'StopBits',1, ...
    'DataBits',8, ...
    'Terminator','CR/LF', ...
    'ReadAsyncMode', 'continuous', ...
    'InputBufferSize',8192);
fopen(SP);
closeFID = onCleanup(@()fclose(SP));

for i=1:5
fprintf(SP,'$PUBX,00*33');
msg = fscanf(SP)

pause(2);
end

fclose(SP);
delete(SP);
