k Braille English Braille is a writing system that uses binary encoding. In Engl
ID: 3573790 • Letter: K
Question
k
Braille English Braille is a writing system that uses binary encoding. In English Braille, each letter of the alphabet and each numberare represented by a cell that contains raised dotsat one or more of six locations, arranged as an arraywith 3 rows and 2 columns. Table 1shows the English Braille representationofthe 10 digits of the decimal system. We w represent a Braille ce in MATLAB as a 3 X2 array where raised dots are represented by ones, and zeros are used elsewhere. We will represent a sequence of n Braille cells in MATLAB as a 3 X2n array where individual cells have been concatenated horizontally. For example, the integer 2 is represented as the 3 X 2 array: 1, 0; 1,0; 0,01 and 24 is represented as the 3 X 4 array: 11, 0, 1, 1; 1, 0, 0, 1; 0, 0, 0,0]. Note that in English Bra e, numbers are preceded by a numeral sign" character, which we omit in this activity Table 1: English Braille representation (the black dots indicate the raised dots) of the ten digits of the decimalsystem. Images are from: en.wikipedia.org/wiki/English Bra n this problem, you will write two MATLAB functions that convert numbers from their Braille representations into other representations Braille conversion to double Write a function with thefollowing header: function result myBraille2Double(braille) where braille is a 3 X 2n array which represents an integer as a sequence of Braille cells as described above, and the result is the number(MATLAB class double") represented by braille Test case >re s u It- myBraille2Double 1,0, 1,1 1,0,0, 1;0,0,0,0 result r e s u It- myBraille2Double 1,0, 1,1,1,0; 1,0,0, 1,0,0 0, 0, 0, 0, 0,01) result 241 r e s u It- my Bra e2Doublei (1,0,0,1, 1,0;0, 1,1,0, 1,1;0, 0, 0, 0,0,0]) r esult 598Explanation / Answer
function result = myBraille2Double(a)
result = '';
b0= [0 1; 1 1; 0 0];
b1=[1 0;0 0;0 0];
b2=[1 0;1 0;0 0];
b3=[1 1; 0 0; 0 0];
b4=[1 1; 0 1; 0 0];
b5=[1 0; 0 1;0 0];
b6=[1 1; 1 0; 0 0];
b7=[1 1; 1 1; 0 0];
b8=[1 0; 1 1; 0 0];
b9=[0 1;1 0;0 0];
a = [1 0 1 1 1 0;
0 1 1 0 1 1;
0 0 0 0 0 0];
[m,n] = size(a);
for i=1:2:n-1
b = a(1:m,i:i+1);
if(eq(b,b0))
result = result + '0';
elseif(eq(b,b1))
result = result + '1';
elseif(eq(b,b2))
result = result + '2';
elseif(eq(b,b3))
result = result + '3';
elseif(eq(b,b4))
result = result + '4';
elseif(eq(b,b5))
result = result + '5';
elseif(eq(b,b6))
result = result + '6';
elseif(eq(b,b7))
result = result + '7';
elseif(eq(b,b8))
result = result + '8';
elseif(eq(b,b9))
result = result + '9';
else
fprintf('-');
end
end
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.