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

Write a matlab function Write a function called hidden that takes a string param

ID: 3810138 • Letter: W

Question

Write a matlab function

Write a function called hidden that takes a string parameter and returns another string which is the hidden message. A hidden message is calculated by taking the first letter of each word (separated by a space). For Example: >> hidden ('great summer time') ans= gst >> hidden ('no on no east') ans= none>> hidden ('this is an example') ans = tiae A Palindrome is a word which is the same when spelled forwards and backwards. Some examples are: glenelg, level, radar, rotor.

Explanation / Answer

hidden.m

function [ str2 ] = hidden( str )
str2= str(regexp([' ' str],'(?<=s+)S','start')-1);
end

Output :-

>> hidden('great summer time')

ans =

gst

>> hidden('no one no east')

ans =

none

>> hidden('this is an example')

ans =

tiae

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