extract a number from 1*1 cell

63 次查看(过去 30 天)
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
  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 CenterFile Exchange 中查找有关 Construct and Work with Object Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by