-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathh2b.m
35 lines (35 loc) · 814 Bytes
/
h2b.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
34
35
function b = h2b(h)
switch h
case {'0'}
b = logical([0 0 0 0]);
case {'1'}
b = logical([0 0 0 1]);
case {'2'}
b = logical([0 0 1 0]);
case {'3'}
b = logical([0 0 1 1]);
case {'4'}
b = logical([0 1 0 0]);
case {'5'}
b = logical([0 1 0 1]);
case {'6'}
b = logical([0 1 1 0]);
case {'7'}
b = logical([0 1 1 1]);
case {'8'}
b = logical([1 0 0 0]);
case {'9'}
b = logical([1 0 0 1]);
case {'A', 'a'}
b = logical([1 0 1 0]);
case {'B', 'b'}
b = logical([1 0 1 1]);
case {'C', 'c'}
b = logical([1 1 0 0]);
case {'D', 'd'}
b = logical([1 1 0 1]);
case {'E', 'e'}
b = logical([1 1 1 0]);
case {'F', 'f'}
b = logical([1 1 1 1]);
end