Question

Matlab write a Matlab function which deletes a first transferred parameter s1 in a second transferred...

Matlab

write a Matlab function which deletes a first transferred parameter s1 in a second transferred parameter s.

e.g delte a letter in a sentence

0 0
Add a comment Improve this question Transcribed image text
Answer #1

For String function, we can use the following regular expression for removing particular string:

str = 'The quick brown fox jumped over the lazy dog';

strn = regexprep(str,'[tixy]','')

The above expression will help you to remove the desired string without using matlab function. Here we have used regular expressions and in the function we have passed the string along with the characters to be removed i.e. t,i,x,y in this case.

The function to be used is as follows:-

erase(str,match)

Syntax: newStr = erase(str,match)

Explanation: In this erase function 'match' helps us to remove all the occurences from the string. Then it returns the remaining string as 'newStr'.

If match is a string array or a cell array of character vectors, then erase deletes every occurrence of every element of match in str. The str and match arguments do not need to be the same size.

Add a comment
Know the answer?
Add Answer to:
Matlab write a Matlab function which deletes a first transferred parameter s1 in a second transferred...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT