How to convert this cell array to matrix

Here is the cell array
C =
3×3 cell array
'27.4' '10581' '28992816'
'27.39' '301' '824439'
'27.39' '53' '145167'
when I use cell2mat, I got this
>> D=cell2mat(C)
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 83)
m{n} = cat(1,c{:,n});

 採用された回答

Walter Roberson
Walter Roberson 2016 年 11 月 23 日

0 投票

If you were able to convert it into a matrix, the matrix would have to be
[ '27.41058128992816';
'27.39301824439';
'27.3953145167']
However, that would not be a legal matrix in MATLAB because the number of columns would not be consistent.
Might I suggest that what you want is
str2double(C)

1 件のコメント

Xing Wang
Xing Wang 2016 年 11 月 23 日
Thank you, it works!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2016 年 11 月 23 日

コメント済み:

2016 年 11 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by