CString CGsCardCtrl::MatlabToFloat(CString strVal)
{
int nIndexE = 0; // 'e '所在位置
float lSvl = 0; // 'e '左侧的数值
int nCount = 0; // 'e '右侧的数值
CString strReturn = " ";
nIndexE = strVal.Find( 'e ');
lSvl = atof(strVal.Left(nIndexE));
nCount = atoi(strVal.Mid(nIndexE + 2, strVal.GetLength()));
if( "- " == strVal.Mid(nIndexE + 1, 1))
{
lSvl = lSvl / pow(10, nCount);
}
else
{
lSvl = lSvl * pow(10, nCount);
}
strReturn.Format( "%f ", lSvl);
return strReturn;
}
|