Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a MATLAB program to translate the Morse code of text messages back into pl

ID: 660633 • Letter: W

Question

Write a MATLAB program to translate the Morse code of text messages back into plain texts.

Code:

input_str= input ('Enter MorseCode:')
input_str= strrep(input_str, '',',')
input_str= strcat(',', input_str, '',',')

morese_code={'.-','-...','-.-.','-..','.','..-.','--.','....','..','.---','-.-','.-..','--','-.','---','.--.','--.-','.-.','...','-','..-','...-','.--','-..-','-.--','--..','/'};
plain_code= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';

for i=1:size(morse_code,2)
str_val= strcat(',', morse_code(i),',');
char = strcar(',', plain_code (i), ',');
i
stri=regexprep(inpute_str,str_val,char);
end
input_str=strrep(input_str, ',','')

This what i have but it shows me error saying "Error (line 1) inpute_str=input ('Enter MorseCode:') PLEASE HELP!!!

PLEASE try running it for yourself.

Explanation / Answer

stri='.---- -. ..--- .. .--- .-.. --... ....- .- .' stri = strcat(' ', stri); morse = {'.-' '-...' '-.-.' '-..' '.' '..-.' '--.' '....' '..' '.---' '-.-' '.-..' '--' '-.' '---' '.--.' '--.-' '.-.' '...' '-' '..-' '...-' '.--' '-..-' '-.--' '--..' '-----' '.----' '..---' '...--' '....-' '.....' '-....' '--...' '---..' '----.'}; code='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; for i=1:size(morse,2) str = strcat(' ',morse(i)); stri = regexprep(stri,str,code(i)) end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote