Dimensions of matrices being concatenated are not consistent error for cell2mat

2 visualizzazioni (ultimi 30 giorni)
out =
'01'
'0.5846023560E-002'
'405504.0000'
'0.9652538155'
'-0.7828897534E-008'
'5153.587402'
'0.2494223175E+001'
'0.529637577'
'0.1359485230E+001'
out = 9*1 cell. I need to convert numeric values of each element of out. I applied
cell2mat(out)
but it gives "Dimensions of matrices being concatenated are not consistent" error. But when I apply
str2num((cell2mat(out(2))))
second element of out converted numeric value. How can I convert numeric values of each element of out?

Risposta accettata

Star Strider
Star Strider il 28 Ago 2016
To convert it to a numeric array, use str2double:
V = str2double(out)
V =
1.0000e+000
5.8460e-003
405.5040e+003
965.2538e-003
-7.8289e-009
5.1536e+003
2.4942e+000
529.6376e-003
1.3595e+000

Più 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