function y = substitute(x) in = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; out = {'#', '.', '~', '1', '_', '>', '-', '*', '<', '=', ':', '4', '\', '8', '+', '2', '?', '7', '!', '3', '0', '9', '6', '@', '&', '5'}; y = lower(x); for i = 1:1:length(y) if strcmp(y(i), ' ') continue; elseif ~isletter(y(i)) error('Input must be a-z or whitespace!'); end y(i) = out{find(strcmp(y(i), in))}; end end