I used the following code, but got an error…
function output_string = codeit(txt);for ii = 1:length(txt) input_char = txt(ii); if input_char>='a'&&input_char<='z'; reverse_alphabet= ['z' 'y' 'x' 'w' 'v' 'u' 't' 's' 'r' 'q' 'p' 'o' 'n' 'm' 'l' 'k' 'j' 'i' 'h' 'g' 'f' 'e' 'd' 'c' 'b' 'a']; reverse_alphabet_index = input_char - 'a' + 1; output_char = reverse_alphabet(reverse_alphabet_index); output_string(ii) = output_char; elseif input_char>='A'&&input_char<='Z'; reverse_alphabet= ['Z' 'Y' 'X' 'W' 'V' 'U' 'T' 'S' 'R' 'Q' 'P' 'O' 'N' 'M' 'L' 'K' 'J' 'I' 'H' 'G' 'F' 'E' 'D' 'C' 'B' 'A']; reverse_alphabet_index = input_char - 'A' + 1; output_char = reverse_alphabet(reverse_alphabet_index); output_string(ii) = output_char; endendendans =Feedback: Your function performed correctly for argument(s) 'azAZ' Feedback: Your program made an error for argument(s) '`_^]\[ {|}~' Your solution is _not_ correct.
Best Answer