str2num function - stringthe function str2num


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

 

 

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: str2num function - stringthe function str2num
Reference No:- TGS0175092

Expected delivery within 24 Hours