this is MATLAB Text Message Abbreviation Decoder Write a function called Decoder
ID: 3880839 • Letter: T
Question
this is MATLAB
Text Message Abbreviation Decoder
Write a function called DecoderMessage that matches a user's input string scalar to a known text message abbreviation, and output the unabbreviated form if known. Otherwise, output: Unknown. Support the abbreviations:
LOL -- laughing out loud
IDK -- I don't know
BFF -- best friends forever
IMHO -- in my humble opinion
TMI - too much information
Restriction: Use the switch branching structure. For example:
Text Message Abbreviation Decoder Write a function called DecoderMessage that matches a user's input string scalar to a known text message abbreviation, and output the unabbreviated form if known. Otherwise, output: Unknown. Support the abbreviations LOL laughing out loud IDK -I don't know BFF -- best friends forever - IMHO in my humble opinion TMI too much information Restriction: Use the switch branching structure. For example: >> userString="LOL..; >> decodedString = DecoderMessage( userString ) decodedString - "laughing out loud" Your Function Save Reset MATLAB Documentation | 1 function decodedst ring = DecoderMessage ( users tring ) % Insert your code here % 4 5 end Code to call your function C ResetExplanation / Answer
Basic syntax of Matlab switch case statement is:
the complete fuction for the give question is:
function decodedString = DecoderMessage( userString)
switch(userString)
case "LOL"
decodedString = "laughing out loud";
case "IDK"
decodedString = "I don't know";
case "BFF"
decodedString = "best friends forever";
case "IMHO"
decodedString = "in my humble opinion";
case "TMI"
decodedString = "too much information";
otherwise
decodedString = "Unknown";
end
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.