extract a number from 1*1 cell

34 views (last 30 days)
alpedhuez on 15 Dec 2020
Commented: Stephen23 on 16 Dec 2020
I have
tbl2 = 1*1 cell array
Name Size Bytes Class Attributes
tbl2 1x1 112 cell
How can one extract a double from this cell array?

Accepted Answer

Image Analyst
Image Analyst on 15 Dec 2020
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:

More Answers (1)

Sibi on 15 Dec 2020
Edited: Sibi on 15 Dec 2020
  1 Comment
Stephen23 on 16 Dec 2020
Edited: Stephen23 on 16 Dec 2020
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.

Sign in to comment.


Find more on Cell Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by