Removing whitespace characters, MATLAB in Engineering

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.

The deblank function will eliminate blank spaces from end of the string. For illustration, when few strings are padded in a string matrix so that all are of similar length, it is often preferred to then eliminate those extra blank spaces in order to actually use the string.

 

>> names = char('Sue', 'Cathy','Xavier')

names =

Sue

Cathy

Xavier

>> name1 = names(1,:)

name1 =

Sue

>> length(name1)

ans =

6

>> name1 = deblank(name1);

>> length(name1)

ans =

3

Posted Date: 10/20/2012 5:24:35 AM | Location : United States







Related Discussions:- Removing whitespace characters, Assignment Help, Ask Question on Removing whitespace characters, Get Answer, Expert's Help, Removing whitespace characters Discussions

Write discussion on Removing whitespace characters
Your posts are moderated
Related Questions
1. Write a MATLAB function (upperTriangle) using the functions you previously created to convert a matrix to upper triangular form. Start with row 1, column1. Find the row that has

Indexing into Vectors of structures: Frequently, when the data structure is a vector of structures, it is essential to iterate through the vector in order by various fields. F

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,

Example of file ploting data: As the other example, a data file called 'compsales.dat' stores the sales figures (in millions) for divisions in a company. Each line in the f

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

Reduced Row Echelon Form: The Gauss Jordan technique results in a diagonal form; for illustration, for a 3 × 3 system: The Reduced Row Echelon Forms take this one step

Example of Plotting from a Function: For illustration, the function can be called as shown below:      >> y = [1:2:9].^3      y =     1  27  125  343  729

Matrix solutions to systems of the linear algebraic equations: The linear algebraic equation is an equation of the form a 1 x 1 + a 2 x 2 + a 3 x 3    .  .  .  .  a n x n

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

Example to change the line width from the default: For illustration, to change the line width from the default of 0.5 to 1.5: >> set(hl,'LineWidth',1.5) As long as the