Hi,
I have a variable '56', I would like to convert it to 56, can anyone help me on this?
Thank you.
|
|
0
|
|
|
|
Reply
|
vijay.easwari (91)
|
7/26/2012 8:45:12 AM |
|
"vj " <vijay.easwari@gmail.com> wrote in message <jur02o$50m$1@newscl01ah.mathworks.com>...
> Hi,
>
> I have a variable '56', I would like to convert it to 56, can anyone help me on this?
> Thank you.
You don't have a lot of additional explanation here, but it appears that you have an integer, single, or double precision number stored as a string variable. What you need to do to convert it depends upon the type of variable and the final numeric data type you need. Some possibilities:
newVar=str2num(cell2mat(cellVar)); % If the number is stored as in a cell as a string
newVar=str2num(strVar); % If stored as a string array
Barry
|
|
0
|
|
|
|
Reply
|
barry.r.williamsNOSPAM (248)
|
7/26/2012 10:14:12 AM
|
|
"Barry Williams" <barry.r.williamsnospam@saic.com> wrote in message <jur59k$li5$1@newscl01ah.mathworks.com>...
> "vj " <vijay.easwari@gmail.com> wrote in message <jur02o$50m$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I have a variable '56', I would like to convert it to 56, can anyone help me on this?
> > Thank you.
>
> You don't have a lot of additional explanation here, but it appears that you have an integer, single, or double precision number stored as a string variable. What you need to do to convert it depends upon the type of variable and the final numeric data type you need. Some possibilities:
>
> newVar=str2num(cell2mat(cellVar)); % If the number is stored as in a cell as a string
> newVar=str2num(strVar); % If stored as a string array
>
> Barry
thank you Barry..
|
|
0
|
|
|
|
Reply
|
vijay.easwari (91)
|
7/28/2012 9:21:12 PM
|
|