Illustration of finding a sting, MATLAB in Engineering

Illustration of finding a sting:

Let's enlarge this, and write a script which creates a vector of strings which are phrases. The outcome is not suppressed so that the strings can be seen whenever the script is executed. It loops throughout the vector and passes each and every string to a function countblanks. This function counts the number of the blank spaces in a string, not involving any leading or trailing blanks.

140_Illustration of Finding a sting.png

1727_Illustration of Finding a sting1.png

 

For illustration, running this script would result in:

>> phraseblanks

phrasemat =

Hello and how are you?

Hi there everyone!

How is it going?

Whazzup?

Phrase 1 had 4 blanks

Phrase 2 had 2 blanks

Phrase 3 had 3 blanks

Phrase 4 had 0 blanks

Posted Date: 10/20/2012 5:32:21 AM | Location : United States







Related Discussions:- Illustration of finding a sting, Assignment Help, Ask Question on Illustration of finding a sting, Get Answer, Expert's Help, Illustration of finding a sting Discussions

Write discussion on Illustration of finding a sting
Your posts are moderated
Related Questions
IS Functions for Strings: There are many functions for strings, that return logical true or false. The function isletter returns the logical true when the character is a lette

Removing Whitespace Characters: The MATLAB has functions which will eliminate trailing blanks from the end of a string and/or leading blanks from the starting of a string.

deblank function: The deblank function eliminates only trailing blanks from the string, not leading the blanks. The strtrim function will eliminate both the leading and traili

Illustration of Preallocating a Vector: Illustration of calling the function: >> myveccumsum([5 9 4]) ans =     5  14  18 At the first time in the loop, outvec wil

Replacing a string - function strrep: The function strrep finds all the occurrences of a substring within the string, and substitutes them with a new substring. The order of a

readlenwid function: function call: [length, width] = readlenwid; function header: function [l,w] = readlenwid In the function call, not any argument is passed; henc

Use polyval to evaluate the derivative at xder. This will be the % slope of the tangent line, "a" (general form of a line: y = ax + b). % 4. Calculate the intercept, b, of t

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 strncmp: The function strncmp compares only the first n characters in the strings and ignores the rest. The initial two arguments are strings to compare, and third ar

Binary Search: The binary search supposes that the vector has been sorted first. The algorithm is just similar to the way it works whenever looking for a name in a phone direc