MATLAB decoding ''braille'' using a table file to decode input into english. Issue with string being returned as a double + possible incorrect use of iterations in for loop?
for instance an input of a matrix = [1 0 0; 0 0 0] (which is equivalent to the first six elements in the table file) will return a double = [97, 0] also, I'm not sure where the zero is coming from I'm lost and would appreciate any hints. Thank you :)
function output = b_decode(input);
load('braille_table.mat', 'table');
x = numel(input)
[r,c] = size(input)
str = zeros(1,c)
for i = 1:6:c;
j = 1:1:(c./2);
if input(i:i+5) == table(1:6)
str(j) = 'a'
elseif input(i:i+5) == table(7:12)
str(j) = 'b'
elseif input(i:i+5) == table(13:18)
str(j) = 'c'
elseif input(i:i+5) == table(19:24)
str(j) = 'd'
elseif input(i:i+5) == table(25:30)
str(j) = 'e'
elseif input(i:i+5) == table(31:36)
str(j) = 'f'
elseif input(i:i+5) == table(37:42)
str(j) = 'g'
elseif input(i:i+5) == table(43:48)
str(j) = 'h'
elseif input(i:i+5) == table(49:54)
str(j) = 'i'
elseif input(i:i+5) == table(55:60)
str(j) = 'j'
elseif input(i:i+5) == table(61:66)
str(j) = 'k'
elseif input(i:i+5) == table(67:72)
str(j) = 'l';
elseif input(i:i+5) == table(73:78)
str(j) = 'm'
elseif input(i:i+5) == table(79:84)
str(j) = 'n'
elseif input(i:i+5) == table(85:90)
str(j) = 'o'
elseif input(i:i+5) == table(91:96)
str(j) = 'p';
elseif input(i:i+5) == table(97:102)
str(j) = 'q'
elseif input(i:i+5) == table(103:108)
str(j) = 'r';
elseif input(i:i+5) == table(109:114)
str(j) = 's'
elseif input(i:i+5) == table(115:120)
str(j) = 't'
elseif input(i:i+5) == table(121:126)
str(j) = 'u'
elseif input(i:i+5) == table(127:132)
str(j) = 'v'
elseif input(i:i+5) == table(133:138)
str(j) = 'w'
elseif input(i:i+5) == table(139:144)
str(j) = 'x'
elseif input(i:i+5) == table(145:150)
str(j) = 'y'
elseif input(i:i+5) == table(151:156)
str(j) == 'z'
end
end;
output = str
end