Str2num function - string, MATLAB in Engineering

str2num function - String:

The function str2num does the opposite; it takes the string in which a number is stored and converts it to the type double:

>> num = str2num('123.456')

num =

  123.4560

 

When there is a string in which there are numbers split by blanks, then the str2num function will convert this to the vector of numbers (of the default type double).

For illustration,

>> mystr = '66 2 111';

>> numvec = str2num(mystr)

numvec =

66  2  111

>> sum(numvec)

ans =

179

 

 

Posted Date: 10/20/2012 5:43:28 AM | Location : United States







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

Write discussion on Str2num function - string
Your posts are moderated
Related Questions
Illustration of gauss-jordan elimination: An illustration of interchanging rows would be r1 ¬→ r3, that would results: Now, beginning with this matrix, an illustration of sc

Forward elimination: In forward elimination, we want to obtain a 0 in the a 21 position. To accomplish this, we can alter the second line in the matrix by subtracting from it

Intersect function and setdiff function: The intersect function rather than returns all the values which can be found in both of the input argument vectors. >> intersect(v

For Loops which do not use an iterator Variable in the action: In all the illustrations that we seen so far, the value of the loop variable has been used in same way in the ac

Interpolation and extrapolation: In most cases, it is desired to estimate values other than at the sampled data points. For illustration, we may want to estimate what the temp

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


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

Algorithm for the function explaine: The algorithm for the function explaine is as shown:  Print a description of e, the exp function, and how to find the approximate va

Plotting from a Function: The following function creates a Figure Window as shown in figure, which shows various types of plots for similar y vector. The vector is passed as a