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.

Compare, find, and replace strings

Compare, find, and replace strings - MATLAB Tutorial

From the course: MATLAB 2018 Essential Training

Start my 1-month free trial

Compare, find, and replace strings

- [Instructor] Most aspects of a business stay consistent, but other parts change. For example, you might change the code for a particular product feature and want to update the text in your file to reflect that change. In this movie, I will show you how to compare strings, find the sub-strings within a larger string, and replace one string with another. I've started MATLAB and I have a blank command window, so I need to define some variables and strings to work with. I'll start by just defining a variable called str1, equal sign. It's a string, so I'll type a single quote. And I will type in the values arl followed by a single quote and Enter. And note that arl is all lowercase. Now in string two, str2, type an equal sign and a single quote. Let's say that I define a product name, or rather code of 19arl73 followed by a single quote and Enter. Now that I have two strings, a sub-string and a longer string, I can start working with them. The first thing I can do is determine whether…

Contents