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
Basic mathematical operations: All the basic mathematical operations can be executed on symbolic expressions and variables (example, add, raise to a power, multiply, subtract,

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

num2str function: The num2str function, that converts real numbers, can be called in many ways. If only the real number is passed to the num2str function, it will generate a s

Illustration of gauss-jordan: Here's an illustration of performing such substitutions by using MATLAB >> a = [1 3 0; 2 1 3; 4 2 3] a = 1 3 0 2 1 3 4 2

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


Function call: In the function call, not any arguments are passed so there are no input arguments in the function header. The function returns an output argument, therefore th

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

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 =

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