Implement a ROT13 cipher - MATLAB Cody - MATLAB Central

Problem 78. Implement a ROT13 cipher

Difficulty:Rate

Replace each character in string s1 with the character that is shifted 13 positions from it (wrap back to the beginning if necessary). So A ? N, B ? O, and so on until Y ? L and Z ? M. Case of the output should match the case of the input, so a ? n. Non-alphabetic characters are left in place and untouched.

If

 s1 = 'I love MATLAB'

then

 s2 = 'V ybir ZNGYNO'

See the Wikipedia article for more info.

Solution Stats

65.99% Correct | 34.01% Incorrect
Last Solution submitted on May 09, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers1694

Suggested Problems

More from this Author96

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!