I want to convert a single cell to a float number

11 vues (au cours des 30 derniers jours)
Jonas Müller
Jonas Müller le 3 Avr 2022
Commenté : Jonas Müller le 3 Avr 2022
i have a cell
celltest = {23.234,123.45};
And I want to convert the first number to float
something like this:
cell2float(celltest(1))

Réponses (3)

David Hill
David Hill le 3 Avr 2022
Should already be a float double. If not then,
double(celltest{1})

the cyclist
the cyclist le 3 Avr 2022
I'm confused. The way you have defined celltest, the first element is already a (double-precision) floating-point number:
celltest = {23.234,123.45};
class(celltest{1})
ans = 'double'
  1 commentaire
Jonas Müller
Jonas Müller le 3 Avr 2022
thank you. My Problem was I used the wrong brackets celltest(1) instead of celltest{1}

Connectez-vous pour commenter.


KSSV
KSSV le 3 Avr 2022
celltest = {23.234,123.45};
class(celltest{1})
ans = 'double'
If it is double, nothing need to be done. If it is a string, read about str2num, str2double.

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by