extract a number from 1*1 cell

86 vues (au cours des 30 derniers jours)
alpedhuez
alpedhuez le 15 Déc 2020
Commenté : Stephen23 le 16 Déc 2020
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?

Réponse acceptée

Image Analyst
Image Analyst le 15 Déc 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:

Plus de réponses (1)

Sibi
Sibi le 15 Déc 2020
Modifié(e) : Sibi le 15 Déc 2020
cell2mat(tbl2)
  1 commentaire
Stephen23
Stephen23 le 16 Déc 2020
Modifié(e) : Stephen23 le 16 Déc 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by