From the course: MATLAB 2018 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Clean text by removing white space and changing case

Clean text by removing white space and changing case - MATLAB Tutorial

From the course: MATLAB 2018 Essential Training

Start my 1-month free trial

Clean text by removing white space and changing case

- [Instructor] When you import text values from a file, you can never be sure what form they'll arrive in. It could contain extra blank characters, or perhaps you'll need to transform the text so that the letters are all in uppercase or lowercase. In this movie, I will show you how to process your strings so they are in the form that you need. I'm in a blank MATLAB command window, so I need to start by defining some variables. I'll start with str1, so just string number one, equal, then a single quote to indicate I'm creating a string, and for this one, I will add a number of blank spaces at the start and then type degrees and close it in single quotes, and enter. Next I'll do string two, str2, equals, single quote, and for this, I will have blank spaces at the beginning and end. I'll just type a number of spaces, it doesn't matter how many, just need to have some there, spaces after, then a single quote and enter. Just to see what happens I concatenate these two strings together…

Contents