Azzera filtri
Azzera filtri

convert string to number in a matrix

1 visualizzazione (ultimi 30 giorni)
Xinfeng Li
Xinfeng Li il 5 Ago 2018
Commentato: dpb il 5 Ago 2018
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 Commenti
Image Analyst
Image Analyst il 5 Ago 2018
Please attach the data file from which you got these along with the code you used to read it in.
dpb
dpb il 5 Ago 2018
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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by