UPC/1sem/octave/08/decode_msg.m
2019-12-17 00:29:33 +07:00

17 lines
320 B
Mathematica

## Author: nuark <nuark@DESKTOP-MJTVANB>
## Created: 2019-12-08
function msg = decode_msg(emsg, code)
alph = ['0':'9' 'A':'F'];
msg = '';
word = '';
for c = emsg
word(end + 1) = c;
match = strcmp(code, word);
if any(match)
msg = strcat(msg, alph(match));
word = '';
end
end
end