octave 06 and 08WIP
This commit is contained in:
parent
e9d7aa3900
commit
c3777e550b
15 changed files with 303 additions and 0 deletions
18
1sem/octave/08/encode_msg.m
Normal file
18
1sem/octave/08/encode_msg.m
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
## Author: nuark <nuark@DESKTOP-MJTVANB>
|
||||
## Created: 2019-12-08
|
||||
|
||||
function emsg = encode_msg(msg, code)
|
||||
alph = ['0':'9' 'A':'F'];
|
||||
l_msg = length(msg);
|
||||
|
||||
emsg = '';
|
||||
for i = 1:l_msg
|
||||
mask = alph == msg(i);
|
||||
if any(mask)
|
||||
emsg = strcat(emsg, code(mask));
|
||||
else
|
||||
warning("[WARN] Symbol '%s' (at pos. %d from msg) not found in alphabet", msg(i), i)
|
||||
end
|
||||
end
|
||||
emsg = emsg{1,1};
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue