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
Technique is to create one element - vector: Technique is to create one element with the values from one structure, and use repmat to replicate it to the preferred size. Then,

calcrectarea subfunction: function call: area = calcrectarea(len,wid); function header: function area = calcrectarea(len, wid)   In the function call, the two arg

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

Implementation of binary search: The binary search can be implemented as a recursive function. The recursive function below also implements this binary search algorithm. It re

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

Displaying expressions: The good-looking function will show such expressions by using exponents; for illustration, >> b = sym('x^2') b = x^2 >> pretty(b)

Function fieldnames - structure functions: The function fieldnames will return the names of the fields which are contained in the structure variable. >> pack_fields = fiel

Function rmfield - structure: The function rmfield eliminates a field from the structure. It returns a new structure with field eliminated, but does not modify the original st

ischar function: The ischar function return the logical true if an array is a character array, or logical false if not. >> vec = 'EK127'; >> ischar(vec) ans =

Q.1: Consider the transmission of a sinusoid x(t) = cos(2f0t) through a channel a ected by multipath and Doppler. Let there be two paths, and assume the sinusoid is being sent fro