Finding a sting - function findstr, MATLAB in Engineering

Assignment Help:

Finding a sting - function findstr:

The function findstr receives two strings as input arguments. It finds all the occurrences of shorter string contained by the longer, and returns the subscripts of the starting of the occurrences. The order of strings does not matter with findstr; it always finds the shorter string within the longer, whichever it is. The shorter string can consist of one character, or any of the number of characters. If there is more than one occurrence of the shorter string within the longer one, the findstr returns a vector with all the indices. Note that, what is returned is the index of the starting of the shorter string.

 

>> findstr('abcde', 'd')

ans =

4

>> findstr('d','abcde')

ans =

4

>> findstr('abcde', 'bc')

ans =

2

>> findstr('abcdeabcdedd', 'd')

ans =

4  9  11  12


Related Discussions:- Finding a sting - function findstr

Interchange rows - gauss-jordan elimination, Interchange rows : for illust...

Interchange rows : for illustration interchanging rows ri and rj is written as

Illustration of symbolic variable, Illustration of symbolic variable: ...

Illustration of symbolic variable: When, on the other hand, z is a symbolic variable to start with, quotes are not required around the expression, and the words are automatica

Executing a program - modular program, Executing a program: Running th...

Executing a program: Running the program would be completed by typing the name of the script; this would call the other functions: >> calcandprintarea Whenever prompt

Function iscellstr - string, Function iscellstr - string function: The...

Function iscellstr - string function: The function iscellstr will return the logical true when a cell array is a cell array of all the strings, or logical false if not. >>

Comparing strings, Comparing strings: There are few functions which co...

Comparing strings: There are few functions which compare strings and return logical true when they are equivalent or logical false when not. The function strcmp compares the s

Reading from a file in a while loop, Reading from a File in a While Loop: ...

Reading from a File in a While Loop: Though in most languages the combination of a loop and an if statement would be essential to determine whether or not the elements in a ve

Related structure functions, Related Structure Functions: There are ma...

Related Structure Functions: There are many functions which can be used with structures in a MATLAB. The function isstruct will return 1 for logical true when the variable arg

Example of menu driven modular program, Example of Menu driven modular prog...

Example of Menu driven modular program: As an illustration of such a menu-driven program, we will write a program to discover the constant e. The constant e, known as the n

Vectors of structures, Vectors of Structures: In numerous applications...

Vectors of Structures: In numerous applications, involving database applications, information generally would be stored in the vector of structures, instead of in individual s

Function imread - image processing, function imread: The function imre...

function imread: The function imread can read an image file, for illustration a JPEG (.jpg) file. The function reads color images into a 3-dimensional matrix. >> myimage1

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd