Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help in MATLAB. take a closer look. Clean-ujp Write a function called CleanUp to tidy up a sentence and produce a string scalar.

I need help in MATLAB. take a closer look.

image text in transcribed

Clean-ujp Write a function called CleanUp to tidy up a sentence and produce a string scalar. In the input sentence, some words are separated by more than one space. The output should produce single spaces between words. Spaces should not appear at the beginning or end of the output sentence. The input sentence is a string scalar and the output sentence is a string scalar Restriction: The function must use join, split, and strip. Hint: Separate the words in the input sentence into a string array, manipulate the resulting string scalars, and then reconstruct the output string scalar Ex: > stringIn stringOut - ours is not to reason why "; stringOut cleanUp (string) "ours is not to reason why" Your Function Save C Reset E MATLAB Documentation 1 function outputsentenceCleanUp (sentence) newText strt rim(sentence); = 4 newText -regexprep (newText,'+',''); 5 outputsentence = newText; 6 end Code to call your function C Reset 1 stringOut-CleanUp(" ours is not to reason why") Previous Assessment: Incorrect Submit Check CleanUp(" ours is not to reason why ") returns stringOut to reason why". "ours is not Check join, split and strip are used The submission must contain the following functions or keywords: join, split, strip The functions join, split, strtrim, and isstring should be used

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions