extract a number from 1*1 cell

85 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 12 月 15 日
コメント済み: Stephen23 2020 年 12 月 16 日
I have
tbl2 = 1*1 cell array
{[1.29]}
Name Size Bytes Class Attributes
tbl2 1x1 112 cell
How can one extract a double from this cell array?

採用された回答

Image Analyst
Image Analyst 2020 年 12 月 15 日
value = tbl{1} % Extract 1.29 from the cell
I think you should really read the FAQ so you get a good intuitive feel for how to use cell arrays and when to use braces, brackets, and parentheses:

その他の回答 (1 件)

Sibi
Sibi 2020 年 12 月 15 日
編集済み: Sibi 2020 年 12 月 15 日
cell2mat(tbl2)
  1 件のコメント
Stephen23
Stephen23 2020 年 12 月 16 日
編集済み: Stephen23 2020 年 12 月 16 日
Basic cell array indexing (as Image Analyst showed) is the simpler, efficient, correct approach. Using CELL2MAT is unnecessarily slow and complex for this trivial task.

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by