convert string to number in a matrix
显示 更早的评论
I have a matrix, but I found there is a error, some numbers are recognized as char. I want to convert these chars to number. Is there any good method?
'ps_ttm' 'fs_operating_revenue' 'fs_operating_revenue_ttm' 'fs_net_cash_flow' 'fs_roe_ttm' 'fs_deducted_profit_ttm' 'fs_roa' 'fs_operating_revenue_qoq'
0.360784860000000 6258259500.00000 0 733387900 0 0 0 0
0.369395460000000 6258259500.00000 0 733387900 0 0 0 0
0.374561850000000 6258259500.00000 0 733387900 0 0 0 0
0.381450330000000 6258259500.00000 0 733387900 0 0 0 0
0.372839720000000 6258259500.00000 0 733387900 0 0 0 0
0.371978640000000 6258259500.00000 0 733387900 0 0 0 0
0.365951200000000 6258259500.00000 0 733387900 0 0 0 0
0.359062730000000 6258259500.00000 0 733387900 0 0 0 0
0.365951200000000 6258259500.00000 0 733387900 0 0 0 0
0.372839720000000 6258259500.00000 0 733387900 0 0 0 0
0.386616700000000 6258259500.00000 0 733387900 0 0 0 0
0.390060930000000 6258259500.00000 0 733387900 0 0 0 0
0.406421120000000 6258259500.00000 0 733387900 0 0 0 0
0.399532620000000 6258259500.00000 0 733387900 0 0 0 0
0.408143250000000 6258259500.00000 0 733387900 0 0 0 0
0.411587480000000 6258259500.00000 0 733387900 0 0 0 0
0.410726430000000 6258259500.00000 0 733387900 0 0 0 0
0.390922000000000 6258259500.00000 0 733387900 0 0 0 0
0.409865350000000 6258259500.00000 0 733387900 0 0 0 0
0.352113660000000 15767742000.0000 '31271006000' 2933652200.00000 '34.6346' '2630252000' '4.3597' '51.9509'
4 个评论
Walter Roberson
2018-8-5
Note: the above is tab delimited.
Walter Roberson
2018-8-5
What data type is your matrix? Is that a cell array in which we should assume that each numeric value is a 1 x 1 numeric cell?
Image Analyst
2018-8-5
Please attach the data file from which you got these along with the code you used to read it in.
dpb
2018-8-5
Along IA's request, look at
doc detectImportOptions
and the appropriate XXXImportOptions object for spreadsheet or delimited text linked to therein. In that import object you can then set the data format for variables not recognized automagically and pass that to the readtable function to import the data correctly.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!