Hi everyone. I have a MATLAB project to decrypt messages using only uppercase characters and spaces(i.e no punctuation). The problem is that my program is working but does not print spaces, instead of a space it prints 7. If anyone can help, I'll be very greatful.Here is my program:(adsbygoogle = window.adsbygoogle || []).push({});

a1 = input('Please enter a sentence: ','s');

p = upper(a1); % Change the text to uppercase

double(p); % String to ASCII codes

for i = 1:numel(p) % Iterate as long as there are characters

% in the string

if (p(i) ~= 32) & (p(i) > 67)

p(i) = p(i) - 3;

elseif (p(i) <= 67)

p(i) = p(i) + 23;

else

* (p(i) == 32)

end

end

disp(p)

* This part seems to be useless.

If the user inputs: khoor pb iulhqg

output: HELLO7MY7FRIEND

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB project to decrypt messages

Loading...

Similar Threads for MATLAB project decrypt |
---|

Binary bitstream from QPSK with MATLAB? |

Python How can I run Python by getting values from Matlab |

What is each step of this Matlab program doing? |

C/++/# Help with MATLAB code? |

Numerical Integration with variable limits MATLAB |

**Physics Forums | Science Articles, Homework Help, Discussion**