How can i write a MATLAB function named dedbi that takes input xtx as string and returns another string xtxx as output.

后端 未结 5 810
遇见更好的自我
遇见更好的自我 2021-01-22 09:38

dedbi reverse the words that is, ‘a’ will be replaced by ‘z’, ‘b’ will be replaced by ‘y’, ‘c’ will be replaced by ‘x’ and so on. dedbi will do the same for capital letter t

5条回答
  •  鱼传尺愫
    2021-01-22 10:27

    I just posted the solution, than I realised that I probably shouldn't solve your assignment. Anyways, here are a couple of tips for you:

    1. You can use the function fliplr() to invert the elements in a (row) vector. (hint: reverse the alphabet)

    2. If you do: [~, index] = ismember('abcd','ac'), than index will be: index=[1 3] (hint: the index of 'a' and c in the alphabet are the same as for z and 'y' in the reverse alphabet)

提交回复
热议问题