I want to convert a single cell to a float number

조회 수: 16 (최근 30일)
Jonas Müller
Jonas Müller 2022년 4월 3일
댓글: Jonas Müller 2022년 4월 3일
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))

답변 (3개)

David Hill
David Hill 2022년 4월 3일
Should already be a float double. If not then,
double(celltest{1})

the cyclist
the cyclist 2022년 4월 3일
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
Jonas Müller
Jonas Müller 2022년 4월 3일
thank you. My Problem was I used the wrong brackets celltest(1) instead of celltest{1}

댓글을 달려면 로그인하십시오.


KSSV
KSSV 2022년 4월 3일
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.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by