extract a number from 1*1 cell

조회 수: 81 (최근 30일)
alpedhuez
alpedhuez 2020년 12월 15일
댓글: Stephen23 2020년 12월 16일
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에서 Convert Image Type에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by