Convert a cell array using str2double
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bharat B
am 2 Jul. 2020
Beantwortet: Walter Roberson
am 2 Jul. 2020
Hi all,
I am trying to convert the following cell array statements into a matrix. Using str2double is giving 'NAN'. and cell2mat is throwing an error as "Dimensions of arrays being concatenated are
not consistent.
Error in cell2mat (line 83)
m{n} = cat(1,c{:,n});"
Any help is appreciated. Thanks
'9, 1., 0.514999986'
'10, 0., 0.514999986'
'11, 1., 0.75'
'12, 0., 0.75'
'13, 0., 0.649999976'
'14, 1., 0.649999976'
'15, 1., 0.25'
'16, 0., 0.25'
'17, 0., 0.'
'18, 1., 0.'
Bharat
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 2 Jul. 2020
C={'9, 1., 0.514999986'
'10, 0., 0.514999986'
'11, 1., 0.75'
'12, 0., 0.75'
'13, 0., 0.649999976'
'14, 1., 0.649999976'
'15, 1., 0.25'
'16, 0., 0.25'
'17, 0., 0.'
'18, 1., 0.'}
cell2mat(cellfun(@str2num,C,'uniform',0))
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!