Finding a sting - function findstr, MATLAB in Engineering

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

Posted Date: 10/20/2012 5:28:34 AM | Location : United States







Related Discussions:- Finding a sting - function findstr, Assignment Help, Ask Question on Finding a sting - function findstr, Get Answer, Expert's Help, Finding a sting - function findstr Discussions

Write discussion on Finding a sting - function findstr
Your posts are moderated
Related Questions
Function used in sound files: The MATLAB has numerous other functions which let you read and play sound or audio files. In the audio files, sampled data for each audio channel

Changing Case: The MATLAB has two functions which convert strings to all uppercase letters, or all lowercase, known as the upper and lower. >> mystring = 'AbCDEfgh';

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 r

Gauss Elimination: The Gauss elimination technique consists of:    Generating the augmented matrix [A b]    Applying EROs to augmented matrix to obtain an upper trian

Illustration of initializing the data structure: illustration of initializing the data structure by preallocating is here as shown: >> cyls(3) = struct('code', 'c', 'dimen

Variable Scope: The scope of any of variable is the workspace in which it is valid. The workspace generated in the Command Window is known as the base workspace. As we know

Matrix definitions: As we know the matrix can be thought of as a table of values in which there are both rows and columns. The most common form of a matrix A (that is sometime

Basic mathematical operations: All the basic mathematical operations can be executed on symbolic expressions and variables (example, add, raise to a power, multiply, subtract,

Interpolation and extrapolation: In most cases, it is desired to estimate values other than at the sampled data points. For illustration, we may want to estimate what the temp

Example of Interpolation and extrapolation: The MATLAB has a function to do this, known as polyfit. The function polyfit finds the coefficients of the polynomial of the partic