Num2str function - string, MATLAB in Engineering

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 string which has four decimal places, that is the default in MATLAB for showing real numbers. The precision can also be identified (that is the number of digits), and format strings can also be passed, which is as shown below:

>> str2 = num2str(3.456789)

str2 =

3.4568

>> length(str2)

ans =

     6

>> str3 = num2str(3.456789,3)

str3 =

3.46

>> str = num2str(3.456789,'%6.2f')

str =

3.46

Note that in the last illustration, MATLAB eliminate the leading blanks from the string.

 

Posted Date: 10/20/2012 5:42:44 AM | Location : United States







Related Discussions:- Num2str function - string, Assignment Help, Ask Question on Num2str function - string, Get Answer, Expert's Help, Num2str function - string Discussions

Write discussion on Num2str function - string
Your posts are moderated
Related Questions
. Generate the following signal, x(n)=1+cos((25*pi*n)/100),0 Compute the DTFT of x[n] for w=0:0.01:2*pi Plot the Real part, imaginary part, the amplitude and phas

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

Technique to creating this structure: An alternative technique of creating this structure, that is not as efficient, includes using the dot operator to refer to fields in the

Replacement : Replace a row by adding it to (or subtract from it) a multiple of the other row. For a given row ri, this is written as   ri  - srj →  ri Note that when r

Image Processing: The Images are represented as grids, or matrices, of picture elements (known as pixels). In MATLAB an image usually is represented as a matrix in which each


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

Simplification Functions: There are numerous functions which work with expressions, and simplify the terms. Not all the expressions can be simplified, but the simplify functio


Passing arguments to functions: In all these functions examples faraway, at least one of the arguments was passed in the function call to be the value(s) of the equivalent inp